simonw / click-app-template-repository

GitHub template repository for creating new Python Click CLI tools, using the simonw/click-app cookiecutter template

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cookiecutter fails on repo creation

felciano opened this issue · comments

I'm trying to use this to create a new CLI tool. After filling out the webform, a new repo is created as expected, but it only contains a README and the .github/workflows directory. The desired template files (tests directory, the app directory with the cli.py starter file, the LICENSE file, etc) are not created, so it looks like maybe cookiecutter isn't being run as expected?

Under the Actions tab the "Initial commit" action shows a red X with "This workflow failed to run", and the run log shows an error at the "Rebuild contents using cookiecutter" step:

mv: cannot move 'plextool/plextool' to './plextool': Directory not empty

I tried rerunning the job and it fails at the same place. I'm not very familiar with GitHub actions -- any suggestions on how to debug further?

Definitely sounds like a bug! Will investigate shortly.

Strange: I can't seem to replicate this, my test run here worked as it should: https://github.com/simonw/test-click-app-bug/runs/4599313389?check_suite_focus=true (now deleted)

Here's the code that would be causing this - specifically line 59:

run: |
# Delete this workflow:
rm -rf .github
export REPO_NAME=$(echo $INFO | jq -r '.repository.name')
# Run cookiecutter
cookiecutter gh:simonw/click-app --no-input \
app_name=$REPO_NAME \
description="$(echo $INFO | jq -r .repository.description)" \
github_username="$(echo $INFO | jq -r .repository.owner.login)" \
author_name="$(echo $INFO | jq -r .repository.owner.name)"
# Move generated content to root directory of repo
mv $REPO_NAME/* .

I'm going to change the workflow to do its thing in /tmp

I tested this new version and it worked for me - @felciano could you try and report back if it works?

Yes, that seems to have solved the issue. Thank you!

I'm going to apply this pattern to my other two repos as well.