8000 Issue-291: Add commit variable to `cookiecutter` context by ESKYoung · Pull Request #292 · cruft/cruft · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Issue-291: Add commit variable to cookiecutter context #292

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 25, 2024

Conversation

ESKYoung
Copy link
Contributor
@ESKYoung ESKYoung commented Feb 25, 2024

Allows users to render the commit SHA in their downstream projects by adding the commit hash within the cookiecutter context dictionary.

This allows users to use the {{ cookiecutter._commit }} Jinja variable in their projects. Truncating to a short hash should be possible with {{ cookiecutter._commit|truncate(7, True, '', 0) }}.

Solves #291, and potentially cookiecutter issue 1212.

Allows users to render the commit SHA in their downstream projects.

See cookiecutter/cookiecutter#1212
Copy link
codecov bot commented Feb 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.71%. Comparing base (1a5614f) to head (013ffa0).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #292   +/-   ##
=======================================
  Coverage   99.71%   99.71%           
=======================================
  Files          21       21           
  Lines        1050     1052    +2     
=======================================
+ Hits         1047     1049    +2     
  Misses          3        3           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ESKYoung
Copy link
Contributor Author

Failing CI check seems to be due to a GitHub connection error. Re-running the check may pass it. Also noting that some of these cookiecutter-test repos stated in test_api.py, and test_cli.py refer to forks or commits in forks, and not the cruft/cookiecutter-test repo.

@holmboe
Copy link
holmboe commented Jun 24, 2024

This is exactly what I was looking for. I want to pass the cookiecutter commit hash into the template so that I can add it into my documents for traceability.

Looking forward to this getting merged.

@szamfirov
Copy link

Hi there, I know this is probably a question more for the maintainers but any movement on this? I'm just wondering when we can see this merged because I'm quite interested in using the functionality.

@sambhav sambhav merged commit 3ccad73 into cruft:main Dec 25, 2024
9 checks passed
@ESKYoung ESKYoung deleted the issue/291 branch December 25, 2024 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3B6C
Development

Successfully merging this pull request may close these issues.

4 participants
0