Skip to content

Commit

Permalink
feat: add cruft config and workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
danb27 committed Apr 6, 2024
1 parent 81416fc commit b446ee3
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/update-cruft-id.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Update Cruft Commit ID

on: [push]

jobs:
update-cruft:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 1

- name: Update .cruft.json with latest commit ID
run: |
# Replace 'path/to/.cruft.json' with the actual path to your .cruft.json file
LATEST_COMMIT_ID=$(git rev-parse HEAD)
echo "Latest commit ID: $LATEST_COMMIT_ID"
# Assuming .cruft.json is at the root and using jq to update it
jq --arg commit "$LATEST_COMMIT_ID" '.commit = $commit' .cruft.json > temp.json && mv temp.json .cruft.json
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "GitHub Actions Bot"
git add .cruft.json
git commit -m "Automatically update .cruft.json with latest commit ID" || echo "No changes to commit"
git push
16 changes: 16 additions & 0 deletions {{ cookiecutter.package_slug }}/.cruft.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"template": "https://github.com/danb27/python-package-template",
"commit": "foo",
"context": {
"cookiecutter": {
"package_name": "{{ cookiecutter.package_name }}",
"package_slug": "{{ cookiecutter.package_slug }}",
"package_title": "{{ cookiecutter.package_title }}",
"package_description": "{{ cookiecutter.package_description }}",
"author_name": "{{ cookiecutter.author_name }}",
"author_email": "{{ cookiecutter.author_email }}",
"line_length": {{ cookiecutter.line_length }}
}
},
"skip": []
}

0 comments on commit b446ee3

Please sign in to comment.