From b96b5493f3f7a0651ed577e8c62951bbc81fd761 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> Date: Tue, 7 Oct 2025 10:45:31 +0200 Subject: [PATCH] Update GitHub Actions workflow for draft release --- .github/workflows/publish_release.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish_release.yml b/.github/workflows/publish_release.yml index a94da57..0b72b4c 100644 --- a/.github/workflows/publish_release.yml +++ b/.github/workflows/publish_release.yml @@ -2,6 +2,7 @@ name: Publish draft release on: workflow_dispatch: + permissions: contents: write pull-requests: write @@ -13,6 +14,7 @@ jobs: - name: Checkout repo uses: actions/checkout@v4 + - name: Get latest draft release id: draft run: | @@ -29,6 +31,7 @@ jobs: fi echo "Found draft version: ${{ steps.draft.outputs.tag_name }}" + - name: Create branch and commit VERSION run: | branch="update-version-${{ steps.draft.outputs.tag_name }}" @@ -37,12 +40,13 @@ jobs: git add VERSION git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" - git commit -m "chore: add VERSION ${{ steps.draft.outputs.tag_name }}" || echo "No changes" - git push origin "$branch" + git commit -m "chore: add VERSION ${{ steps.draft.outputs.tag_name }}" || echo "No changes to commit" + git push --set-upstream origin "$branch" --force - - name: Create PR - uses: peter-evans/create-pull-request@v6 + + - name: Create pull request id: pr + uses: peter-evans/create-pull-request@v6 with: token: ${{ secrets.GITHUB_TOKEN }} branch: "update-version-${{ steps.draft.outputs.tag_name }}" @@ -51,6 +55,7 @@ jobs: body: "This PR adds or updates the VERSION file for ${{ steps.draft.outputs.tag_name }}" labels: automated + - name: Auto-merge PR uses: peter-evans/enable-pull-request-automerge@v2 with: @@ -58,7 +63,7 @@ jobs: pull-request-number: ${{ steps.pr.outputs.pull-request-number }} merge-method: squash - - name: Wait for merge + - name: Wait for PR merge uses: actions/github-script@v7 with: script: |