Closed 8bitsam closed 3 weeks ago
Is there a way to test this? Can we instead use {{ cookiecutter.full_name }}
and {{ cookiecutter.project_name }}
? This way the cookiecutter will automatically put in our GitHub repos and names for easier readibility/editability when we actually start developing the built package.
I used the documentation here: https://docs.github.com/en/actions/learn-github-actions/contexts#github-context I can test it the other way, though and will change it if that works.
I am nervous about this approach, I think I prefer @Sparks29032 approach.
Also, cookiecutter.full_name
is deprecated and replaced with cookiecutter.github_org
I've tried the cookiecutter approach, but it doesn't seem to fill in. Looking at other cookiecutters, it might be something that changes only after a commit.
That's weird
I've looked at a bunch of other cookiecutter repos and none of them seem to have any reference to cookiecutter.(...)
anywhere in the .github/workflows yml files. I tried it without the $'s and it still didn't work, I could go back to the way I was doing it before with the github actions (docs that I linked) and make a test repo?
I've looked at a bunch of other cookiecutter repos and none of them seem to have any reference to
cookiecutter.(...)
anywhere in the .github/workflows yml files. I tried it without the $'s and it still didn't work, I could go back to the way I was doing it before with the github actions (docs that I linked) and make a test repo?
sure, give it a shot
I added another function to the post gen hooks which solves the issue. The git diff output seems to look good now:
Note: the merge conflict is only because I added import os
at the top of post_gen_project.py
Can we use Path.cwd() instead of os?
Yep, just checked and it works.
Same with os.join
, let's just do Path.cwd() / .github / workflows / main.yml
and remove the os
import.
Also replace full_name
with github_org
after testing.
Thanks @8bitsam please can we have another diff just to check and then I can merge.
This is the git diff for main.yml:
is that the complete diff?
There was also a git diff for docs.yml, but the output was completely blank since the two files are completely identical (no package-specific naming).
@sbillinge @8bitsam This PR has been here for a while, is it ready to merge?
I think it should be, the git diff for main.yml is above, and the git diff for docs.yml is blank (exact same as diffpy.utils)
Thanks for the confirmation @8bitsam . Merged
Closes #16 The workflow variables would be filled in automatically upon the first git commit. See![Screenshot from 2024-06-20 12-16-16](https://github.com/Billingegroup/cookiecutter/assets/32941464/872e23ec-e384-4f60-9f74-5b317fc77bba)
git diff
result: