Billingegroup / cookiecutter

A cookie-cutter for DiffPy packages.
Other
0 stars 7 forks source link

Remodel main.yml to reflect diffpy.utils #48

Closed 8bitsam closed 3 weeks ago

8bitsam commented 3 weeks ago

Closes #16 The workflow variables would be filled in automatically upon the first git commit. See git diff result: Screenshot from 2024-06-20 12-16-16

Sparks29032 commented 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.

8bitsam commented 3 weeks ago

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.

sbillinge commented 3 weeks ago

I am nervous about this approach, I think I prefer @Sparks29032 approach.

Also, cookiecutter.full_name is deprecated and replaced with cookiecutter.github_org

8bitsam commented 3 weeks ago

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. Screenshot from 2024-06-20 15-41-26

sbillinge commented 3 weeks ago

That's weird

8bitsam commented 3 weeks ago

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?

sbillinge commented 3 weeks ago

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

8bitsam commented 3 weeks ago

I added another function to the post gen hooks which solves the issue. The git diff output seems to look good now: Screenshot from 2024-06-21 11-30-23

8bitsam commented 3 weeks ago

Note: the merge conflict is only because I added import os at the top of post_gen_project.py

Sparks29032 commented 3 weeks ago

Can we use Path.cwd() instead of os?

8bitsam commented 3 weeks ago

Yep, just checked and it works.

Sparks29032 commented 3 weeks ago

Same with os.join, let's just do Path.cwd() / .github / workflows / main.yml and remove the os import.

Sparks29032 commented 3 weeks ago

Also replace full_name with github_org after testing.

sbillinge commented 3 weeks ago

Thanks @8bitsam please can we have another diff just to check and then I can merge.

8bitsam commented 3 weeks ago

This is the git diff for main.yml: Screenshot from 2024-06-24 17-23-45

sbillinge commented 3 weeks ago

is that the complete diff?

8bitsam commented 3 weeks ago

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).

Sparks29032 commented 3 weeks ago

@sbillinge @8bitsam This PR has been here for a while, is it ready to merge?

8bitsam commented 3 weeks ago

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)

sbillinge commented 3 weeks ago

Thanks for the confirmation @8bitsam . Merged