Skip to content

Commit

Permalink
Customize branch name (#201)
Browse files Browse the repository at this point in the history
Add the `branch_name_extension` input for the CI - Check
dependencies callable workflow.

If set, it will append a forward slash (/) and its value to the branch
name created for the PR, which will update the dependencies.

This has been tested through temporary commits and manual runs
in this repository (see #199 and #200).
  • Loading branch information
CasperWA authored Oct 23, 2023
1 parent 187ea23 commit 3455ecc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 6 additions & 1 deletion .github/workflows/ci_check_pyproject_dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ on:
required: false
type: string
default: ""
branch_name_extension:
description: "A string to append to the branch name of the created PR. Example: `'-my-branch'`. It will be appended after a forward slash, so the final branch name will be `ci/update-pyproject/-my-branch`."
required: false
type: string
default: ""
secrets:
PAT:
description: "A personal access token (PAT) with rights to update the `permanent_dependencies_branch`. This will fallback on `GITHUB_TOKEN`."
Expand Down Expand Up @@ -140,7 +145,7 @@ jobs:
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
committer: "${{ inputs.git_username }} <${{ inputs.git_email }}>"
author: "${{ inputs.git_username }} <${{ inputs.git_email }}>"
branch: ci/update-pyproject
branch: ci/update-pyproject${{ inputs.branch_name_extension && format('/{0}', inputs.branch_name_extension) || ''}}
delete-branch: true
title: "[Auto-generated] Check & update dependencies (`pyproject.toml`)"
body: ${{ steps.pr_body.outputs.result }}
Expand Down
5 changes: 5 additions & 0 deletions docs/workflows/ci_check_pyproject_dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ The reason for having this workflow and not using [Dependabot](https://github.co
If a PAT is not passed through for the `PAT` secret and `GITHUB_TOKEN` is used, beware that any other CI/CD jobs that run for, e.g., pull request events, may not run since `GITHUB_TOKEN`-generated PRs are designed to not start more workflows to avoid escalation.
Hence, if it is important to run CI/CD workflows for pull requests, consider passing a PAT as a secret to this workflow represented by the `PAT` secret.

!!! info
The generated PR will be created from a new branch named `ci/update-pyproject`.
If you wish to change this value, see the [`branch_name_extension`](#inputs) input option.

## Ignoring dependencies

To ignore or configure how specific dependencies should be updated, the `ignore` input option can be utilized.
Expand Down Expand Up @@ -65,6 +69,7 @@ The repository contains the following:
| `fail_fast` | Whether the task to update dependencies should fail if any error occurs. | No | `false` | _boolean_ |
| `pr_labels` | A comma separated list of strings of GitHub labels to use for the created PR. | No | _Empty string_ | _string_ |
| `ignore` | Create ignore conditions for certain dependencies. A multi-line string of ignore rules, where each line is an ellipsis-separated (`...`) string of key/value-pairs. One line per dependency. This option is similar to [the `ignore` option of Dependabot](https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#ignore).</br></br>See also [Single vs multi-line input](index.md#single-vs-multi-line-input). | No | _Empty string_ | _string_
| `branch_name_extension` | A string to append to the branch name of the created PR. Example: `'-my-branch'`. It will be appended after a forward slash, so the final branch name will be `ci/update-pyproject/-my-branch`. | No | _Empty string_ | _string_ |

## Secrets

Expand Down

0 comments on commit 3455ecc

Please sign in to comment.