![]() cruft.json file" fi echo "has_changes=$CHANGES" > "$GITHUB_OUTPUT" - name : Run update if available if : _changes = '1' run : | git config -global user.email git config -global user.name "GitHub" cruft update -skip-apply-ask -refresh-private-variables git restore -staged. branch : cruft/reject commit-message : "chore: reject new Cruft update" title : Reject new updates detected with Cruft steps : - uses : - uses : with : python-version : "3.10" - name : Install Cruft run : pip3 install cruft - name : Check if update is available continue-on-error : false id : check run : | CHANGES=0 if then if ! cruft check then CHANGES=1 fi else echo "No. cruft.json body : Use this to reject the changes in this repository. branch : cruft/update commit-message : "chore: accept new Cruft update" title : New updates detected with Cruft - add-paths. body : Use this to merge the changes to this repository. # /.github/workflows/cruft-update.yml name : Update repository with Cruft permissions : contents : write pull-requests : write on : schedule : - cron : "0 2 * * 1" # Every Monday at 2am jobs : update : runs-on : ubuntu-latest strategy : fail-fast : true matrix : include : - add-paths. This can be enabled on a per-organisation level, or a per-registry level for personal projects. Since Jan 2022, registries/organisations must explicitly grant the authority to create a pull request. cruft.json file only, which has the effect of rejecting the change from the upstream repository. It creates two PRs - one to pull in the new files to the repository and one to update the. This example runs every Monday at 2am UTC and creates a new pull request if there are changes detected which a maintainer can accept or reject. If you have many repositories to manage, you can automate the change detection process with GitHub Actions. cruft.json to make stricter CI checks that ensures any improvement to the template is always submitted upstream. You can combine this flag with the skip section of your. The cruft diff command optionally accepts an -exit-code flag that will make cruft exit with a non-0 code should any diff is found. If any local file differs from the template, the diff will appear in your terminal in a similar fashion to git diff. Cruft allows you to quickly see what changed in your local project compared to the template. With time, your boilerplate may end up being very different from the actual cookiecutter template. You can then specify the last commit of the template the project has been updated to be consistent with, or accept the default of using the latest commit from the template. To create a new project using cruft run cruft create PROJECT_URL from the command line. Pipenv install cruft Creating a New Project: To get started - install cruft using a Python package manager: Automatic Template Updates: cruft automates the process of updating code to match the latest version of a template, making it easy to utilize template improvements across many projects.This check can easily be added to CI pipelines to ensure your projects stay in-sync. Template Validation: cruft can quickly validate whether or not a project is using the latest version of a template using cruft check.Meaning it retains full compatibility with all existing Cookiecutter templates. Cookiecutter Compatible: cruft utilizes Cookiecutter as its template expansion engine.cruft makes sure your code stays in-sync with the template it came from for you. It automates the creation of new projects like the others, but then it also helps you to manage the boilerplate through the life of the project. This seems great! However, once created, most leave you with that copy-and-pasted code to manage through the life of your project.Ĭruft is different. ![]() Many project template utilities exist that automate the copying and pasting of code to create new projects. Read Latest Documentation - Browse GitHub Code RepositoryĬruft allows you to maintain all the necessary boilerplate for packaging and building projects separate from the code you intentionally write.įully compatible with existing Cookiecutter templates.Ĭreating new projects from templates using cruft is easy:Īnd, so is updating them as the template changes overtime:
0 Comments
Leave a Reply. |