Generate from a cookiecutter template as part of your github workflow
Runs cookiecutter on the specified template, passing in the values input as cookiecutterValues.
This action does not commit or push any files, check out an action like stefanzweifel/git-auto-commit-action for a way to commit generated files.
name: Run Cookiecutter
on: [workflow_dispatch]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Run Cookiecutter
uses: andrewthetechie/gha-cookiecutter@main
with:
# can be a link to a git repo or a local path
template: https://github.com/cjolowicz/cookiecutter-hypermodern-python
cookiecutterValues: '{
"foo": "bar",
"baz": "boo",
"num": 2
}'
Or to use a cookiecutter in a private repo, use a checkout with a token that has access to that repo
name: Run Cookiecutter Private
on: [workflow_dispatch]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
repository: "yourprivatecookiecutter"
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run Cookiecutter
uses: andrewthetechie/gha-cookiecutter@main
with:
# path to what you checked out
template: ./yourprivatecookiecutter
cookiecutterValues: '{
"foo": "bar",
"baz": "boo",
"num": 2
}'
parameter | description | required | default |
---|---|---|---|
cookiecutterValues | Json blob to pass to the cookiecutter template. Any values not filled in will be set to template's default | false |
{} |
template | A directory containing a project template directory (or zip file), or a URL to a git repository. | true |
|
templateCheckout | The branch, tag or commit ID to checkout after clone. | false |
|
templateDirectory | Relative path to a cookiecutter template in a repository. | false |
|
outputDir | Where to output the generated project dir into. | false |
. |
overwrite | Overwrite files if they already exist in outputDir if true. Takes priority over 'skip' | false |
false |
skip | Skip files if they already exist in outputDir if true. Ignored if 'overwrite' is true | false |
false |
zipPassword | If your template zip is password protected, put your password here | false |
|
acceptHooks | Accept pre and post hooks if set to true. | false |
true |
parameter | description |
---|---|
outputDir | Directory the cookiecutter outputted to |
This action is a docker
action.
Thanks go to these wonderful people (emoji key):
Andrew 💻 📖 |
Laura Armitage 💻 🐛 |