From b81b981dd4b5a675ee27f37db49acfcfdbb0754c Mon Sep 17 00:00:00 2001 From: "Patrick M. Niedzielski" Date: Mon, 9 Nov 2026 16:48:57 -0500 Subject: [PATCH] CI: Create a release PR from the release workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch makes the Prepare Release workflow generate a pull request after bumping the version. Right now, there is no automation to publish a release to GitHub and PyPI when a PR is approved and merged. We use the `peter-evans/create-pull-request` GitHub Action to make this easier. While this introduces an external dependency, it handles idempotency in case this workflow is run multiple times for the same release version, and also gives us a more declarative syntax for generating PRs. When this PR is created, it will be authored by `github-actions[bot]` and include only the version bump and the towncrier changes. Unfortunately, PRs generated by GitHub Actions get their own workflows queued in an “approval-required” state, which means someone will have to click a button on the PR to run the CI. This is to avoid infinite chains of CI workflows being run automatically with no human involved. We can provide a separate token, which we can generate independently and store as a secret, which is not subject to this restriction if we find it annoying. See [the GitHub docs on this](https://docs.github.com/en/actions/how-tos/write-workflows/choose-when-workflows-run/trigger-a-workflow#triggering-a-workflow-from-a-workflow) for more details. --- .github/workflows/prepare-release.yml | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml index 042844e..008c689 100644 --- a/.github/workflows/prepare-release.yml +++ b/.github/workflows/prepare-release.yml @@ -9,7 +9,8 @@ on: required: true permissions: - contents: read + contents: write + pull-requests: write jobs: prepare: @@ -50,5 +51,20 @@ jobs: VERSION: ${{ inputs.version }} run: uvx towncrier build --name blazingmq --version "$VERSION" --yes - - name: Show release changes - run: git --no-pager diff HEAD + - name: Create release PR + uses: peter-evans/create-pull-request@15733dbdfeedb4f7fdb73d13c6f5ac83b710fab8 # v8.1.2 + with: + base: main + branch: automation/prepare-release-v${{ inputs.version }} + add-paths: | + src/blazingmq/_about.py + CHANGELOG.md + news/ + author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> + signoff: true + commit-message: 'Chore: Prepare release v${{ inputs.version }}' + title: 'Chore: Prepare release v${{ inputs.version }}' + body: | + This patch prepares release v${{ inputs.version }} by updating the + package version and generating the changelog with Towncrier. + labels: skip news