From e3e8ebba8fd7bcda495942e215d727ea8b06b7d0 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Wed, 25 Feb 2026 21:24:57 +0000 Subject: [PATCH 1/2] Add workflow for creating release pull requests --- .github/workflows/create-release-pr.yml | 96 +++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 .github/workflows/create-release-pr.yml diff --git a/.github/workflows/create-release-pr.yml b/.github/workflows/create-release-pr.yml new file mode 100644 index 000000000..1979d50c4 --- /dev/null +++ b/.github/workflows/create-release-pr.yml @@ -0,0 +1,96 @@ +--- +# NOTE: This workflow belongs in the github/backup-utils repository. +# It is stored here for convenience and should be copied to +# github/backup-utils/.github/workflows/create-release-pr.yml +# +# This workflow is triggered via repository_dispatch from the +# build-and-release workflow in backup-utils-private. It copies +# docs and README.md from backup-utils-private onto a release branch +# in backup-utils, then creates a PR using GITHUB_TOKEN so that the +# PR author is github-actions[bot]. This allows the app token in +# backup-utils-private to approve the PR as a different actor. +name: Create Release PR + +on: + repository_dispatch: + types: [create-release-pr] + +permissions: + contents: write + pull-requests: write + +jobs: + create-release-pr: + runs-on: ubuntu-latest + steps: + - uses: actions/create-github-app-token@v1 + id: app-token + with: + app-id: ${{ vars.RELEASE_CONTROLLER_APP_ID }} + private-key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }} + owner: ${{ github.repository_owner }} + repositories: "backup-utils-private" + + - name: Checkout backup-utils + uses: actions/checkout@v5 + + - name: Checkout backup-utils-private + uses: actions/checkout@v5 + with: + token: ${{ steps.app-token.outputs.token }} + repository: github/backup-utils-private + path: './backup-utils-private' + + - name: Replace docs directory with backup-utils-private docs + run: | + rm -rf docs + cp -r backup-utils-private/docs docs + + - name: Replace README.md with backup-utils-private README.md + run: | + rm README.md + cp backup-utils-private/README.md README.md + + - name: Delete backup-utils-private + run: | + rm -rf backup-utils-private + + - name: Create release branch commit + run: | + version="${{ github.event.client_payload.version }}" + branch="release/$version" + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git checkout -B "$branch" + git add docs README.md + git commit --allow-empty -m "$version release" + git push --force-with-lease --set-upstream origin "$branch" + + - name: Create or find release pull request + id: release-pr + env: + GH_TOKEN: ${{ github.token }} + run: | + version="${{ github.event.client_payload.version }}" + branch="release/$version" + pr_number="$(gh pr list --head "$branch" --base master --json number --jq '.[0].number')" + + if [ -z "$pr_number" ]; then + pr_url="$(gh pr create \ + --base master \ + --head "$branch" \ + --title "$version release" \ + --body "Automated release PR for v$version.")" + pr_number="${pr_url##*/}" + fi + + echo "number=$pr_number" >> "$GITHUB_OUTPUT" + + - name: Enable auto-merge on release pull request + env: + GH_TOKEN: ${{ github.token }} + run: | + gh pr merge \ + --squash \ + --auto \ + "${{ steps.release-pr.outputs.number }}" From fec989601c4082473935f72e7a4e1d4cf779a788 Mon Sep 17 00:00:00 2001 From: Tim Reimherr Date: Wed, 25 Feb 2026 21:27:46 +0000 Subject: [PATCH 2/2] Fix comment --- .github/workflows/create-release-pr.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/create-release-pr.yml b/.github/workflows/create-release-pr.yml index 1979d50c4..dcaceb679 100644 --- a/.github/workflows/create-release-pr.yml +++ b/.github/workflows/create-release-pr.yml @@ -1,11 +1,7 @@ --- -# NOTE: This workflow belongs in the github/backup-utils repository. -# It is stored here for convenience and should be copied to -# github/backup-utils/.github/workflows/create-release-pr.yml -# # This workflow is triggered via repository_dispatch from the # build-and-release workflow in backup-utils-private. It copies -# docs and README.md from backup-utils-private onto a release branch +# docs and README.md from backup-utils-private to a release dev branch # in backup-utils, then creates a PR using GITHUB_TOKEN so that the # PR author is github-actions[bot]. This allows the app token in # backup-utils-private to approve the PR as a different actor.