diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index 9af2db4d1..7930f7df7 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -8,22 +8,22 @@ def remove_file(filepath): Path(PROJECT_DIRECTORY).joinpath(filepath).unlink() -def remove_folder(folderpath): - for file in Path(PROJECT_DIRECTORY).joinpath(folderpath).iterdir(): +def remove_folder(folder_path): + for file in Path(PROJECT_DIRECTORY).joinpath(folder_path).iterdir(): if not file.is_dir(): file.unlink() continue file.rmdir() - Path(PROJECT_DIRECTORY).joinpath(folderpath).rmdir() + Path(PROJECT_DIRECTORY).joinpath(folder_path).rmdir() def replace_contents(filepath): replacements = { - "__GITHUB_REF__": "github.ref", + "__BUMPVERSION_TOKEN__": "secrets.BUMPVERSION_TOKEN", + "__GITHUB_REF_NAME__": "github.ref_name", "__GITHUB_TOKEN__": "secrets.GITHUB_TOKEN", "__PYTHON_VERSION__": "matrix.python-version", "__TOX_ENV__": "matrix.tox-env", - "__WORKFLOW_TOKEN__": "secrets.WORKFLOW_TOKEN", } lines = [] diff --git a/{{cookiecutter.project_slug}}/.github/workflows/actions-versions-updater.yml b/{{cookiecutter.project_slug}}/.github/workflows/actions-versions-updater.yml index e3d2b6a8d..44f316732 100644 --- a/{{cookiecutter.project_slug}}/.github/workflows/actions-versions-updater.yml +++ b/{{cookiecutter.project_slug}}/.github/workflows/actions-versions-updater.yml @@ -1,3 +1,7 @@ +# This workflow requires a personal access token repository secret named `BUMPVERSION_TOKEN` with the following privileges: +# - repo +# - workflow + name: GitHub Actions Version Updater on: @@ -13,12 +17,12 @@ jobs: - uses: actions/checkout@v4.1.1 with: # This requires a personal access token with the privileges to push directly to `main` - token: __WORKFLOW_TOKEN__ + token: __BUMPVERSION_TOKEN__ persist-credentials: true - name: Run GitHub Actions Version Updater uses: saadmk11/github-actions-version-updater@v0.8.1 with: - token: __WORKFLOW_TOKEN__ + token: __BUMPVERSION_TOKEN__ committer_email: 'bumpversion[bot]@ouranos.ca' committer_username: 'update-github-actions[bot]' pull_request_title: '[bot] Update GitHub Action Versions' diff --git a/{{cookiecutter.project_slug}}/.github/workflows/bump-version.yml b/{{cookiecutter.project_slug}}/.github/workflows/bump-version.yml index e109b9e33..c6e52a699 100644 --- a/{{cookiecutter.project_slug}}/.github/workflows/bump-version.yml +++ b/{{cookiecutter.project_slug}}/.github/workflows/bump-version.yml @@ -1,3 +1,7 @@ +# This workflow requires a personal access token named `BUMPVERSION_TOKEN` with the following privileges: +# - repo +# - workflow + name: "Bump Patch Version" on: @@ -17,8 +21,8 @@ on: {%- if cookiecutter.create_author_file == 'y' %} - AUTHORS.rst {%- endif %} - - CONTRIBUTING.rst - CHANGES.rst + - CONTRIBUTING.rst - Makefile {%- if cookiecutter.make_docs == 'y' %} - .readthedocs.yml @@ -29,7 +33,6 @@ on: {%- if cookiecutter.use_conda == 'y' %} - environment-dev.yml {%- endif %} - - setup.cfg - pyproject.toml - tests/**.py - tox.ini @@ -62,5 +65,5 @@ jobs: uses: ad-m/github-push-action@master with: force: false - github_token: __WORKFLOW_TOKEN__ + github_token: __BUMPVERSION_TOKEN__ branch: __GITHUB_REF__ diff --git a/{{cookiecutter.project_slug}}/.github/workflows/first_pull_request.yml b/{{cookiecutter.project_slug}}/.github/workflows/first_pull_request.yml index adc51fe06..16c472f92 100644 --- a/{{cookiecutter.project_slug}}/.github/workflows/first_pull_request.yml +++ b/{{cookiecutter.project_slug}}/.github/workflows/first_pull_request.yml @@ -39,7 +39,7 @@ jobs: repo: context.repo.repo, body: `**Welcome**, new contributor! - It appears that this is your first Pull Request. To give credit where it's due, we ask that you add your information to the \`AUTHORS.rst\` and \`.zenodo.json\`.: + It appears that this is your first Pull Request. To give credit where it's due, we ask that you add your information to the \`AUTHORS.rst\` and \`.zenodo.json\`: - [ ] The relevant author information has been added to \`AUTHORS.rst\` and \`.zenodo.json\`. Please make sure you've read our [contributing guide](CONTRIBUTING.rst). We look forward to reviewing your Pull Request shortly ✨` diff --git a/{{cookiecutter.project_slug}}/.github/workflows/main.yml b/{{cookiecutter.project_slug}}/.github/workflows/main.yml index 736e8380a..51411c9d1 100644 --- a/{{cookiecutter.project_slug}}/.github/workflows/main.yml +++ b/{{cookiecutter.project_slug}}/.github/workflows/main.yml @@ -5,10 +5,11 @@ on: branches: - main paths-ignore: + - .cruft.json - CHANGES.rst - README.rst - pyproject.toml - - setup.cfg + - tests/test_{{ cookiecutter.project_slug }}.py - {{ cookiecutter.project_slug }}/__init__.py pull_request: diff --git a/{{cookiecutter.project_slug}}/.github/workflows/tag-testpypi.yml b/{{cookiecutter.project_slug}}/.github/workflows/tag-testpypi.yml index 4418173e6..e78c80c64 100644 --- a/{{cookiecutter.project_slug}}/.github/workflows/tag-testpypi.yml +++ b/{{cookiecutter.project_slug}}/.github/workflows/tag-testpypi.yml @@ -20,8 +20,8 @@ jobs: # This token is provided by Actions, you do not need to create your own token GITHUB_TOKEN: __GITHUB_TOKEN__ with: - tag_name: __GITHUB_REF__ - name: Release __GITHUB_REF__ + tag_name: __GITHUB_REF_NAME__ + name: Release __GITHUB_REF_NAME__ draft: true prerelease: false