From 305402d23312d58508bf46e332a77abf7572672d Mon Sep 17 00:00:00 2001 From: okafke <65917827+okafke@users.noreply.github.com> Date: Tue, 11 Nov 2025 15:07:06 +0100 Subject: [PATCH 01/11] chore(ci): fix check for new mc version workflow --- .github/workflows/new-mc-version.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/new-mc-version.yml b/.github/workflows/new-mc-version.yml index 9deaa8b..3ea19ef 100644 --- a/.github/workflows/new-mc-version.yml +++ b/.github/workflows/new-mc-version.yml @@ -10,6 +10,7 @@ jobs: permissions: contents: write pull-requests: write + actions: write steps: - name: Checkout repository From bb0a71de8f07f3f89bac736baf71091bcc697b6b Mon Sep 17 00:00:00 2001 From: okafke <65917827+okafke@users.noreply.github.com> Date: Tue, 11 Nov 2025 15:11:00 +0100 Subject: [PATCH 02/11] chore(ci): login to modify workflow files --- .github/workflows/new-mc-version.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/new-mc-version.yml b/.github/workflows/new-mc-version.yml index 3ea19ef..f2fccb2 100644 --- a/.github/workflows/new-mc-version.yml +++ b/.github/workflows/new-mc-version.yml @@ -43,6 +43,7 @@ jobs: if: steps.git-check.outputs.changes == 'true' id: push-branch run: | + gh auth login -s workflow BRANCH_NAME="version-${LATEST_VERSION}" git checkout -b "$BRANCH_NAME" git add . From 2b3f62c47ee0bd5ca3e3b26e762509e4f0077bd5 Mon Sep 17 00:00:00 2001 From: okafke <65917827+okafke@users.noreply.github.com> Date: Tue, 11 Nov 2025 15:30:00 +0100 Subject: [PATCH 03/11] chore(ci): use special token to create PRs that change workflows --- .github/workflows/new-mc-version.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/new-mc-version.yml b/.github/workflows/new-mc-version.yml index f2fccb2..dba2013 100644 --- a/.github/workflows/new-mc-version.yml +++ b/.github/workflows/new-mc-version.yml @@ -10,11 +10,12 @@ jobs: permissions: contents: write pull-requests: write - actions: write steps: - name: Checkout repository uses: actions/checkout@v4 + with: + token: ${{ secrets.MC_VERSION_WORKFLOW_TOKEN }} - name: Set up Python uses: actions/setup-python@v5 @@ -43,7 +44,6 @@ jobs: if: steps.git-check.outputs.changes == 'true' id: push-branch run: | - gh auth login -s workflow BRANCH_NAME="version-${LATEST_VERSION}" git checkout -b "$BRANCH_NAME" git add . From d9d3d3d4cd1e66e9c147219a3b326cdb100c5628 Mon Sep 17 00:00:00 2001 From: okafke <65917827+okafke@users.noreply.github.com> Date: Tue, 11 Nov 2025 15:37:01 +0100 Subject: [PATCH 04/11] chore(ci): actually add files to push --- .github/workflows/new-mc-version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/new-mc-version.yml b/.github/workflows/new-mc-version.yml index dba2013..a1ddc17 100644 --- a/.github/workflows/new-mc-version.yml +++ b/.github/workflows/new-mc-version.yml @@ -46,7 +46,7 @@ jobs: run: | BRANCH_NAME="version-${LATEST_VERSION}" git checkout -b "$BRANCH_NAME" - git add . + git add --all git commit -m "feat: ${LATEST_VERSION}" git push origin "$BRANCH_NAME" echo "branch=$BRANCH_NAME" >> $GITHUB_OUTPUT From 8d1ea34a2282f7cafc88ac451e9593a5555b304e Mon Sep 17 00:00:00 2001 From: okafke <65917827+okafke@users.noreply.github.com> Date: Tue, 11 Nov 2025 15:43:35 +0100 Subject: [PATCH 05/11] chore(ci): create PR with gh cli --- .github/workflows/new-mc-version.yml | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/.github/workflows/new-mc-version.yml b/.github/workflows/new-mc-version.yml index a1ddc17..b691861 100644 --- a/.github/workflows/new-mc-version.yml +++ b/.github/workflows/new-mc-version.yml @@ -49,14 +49,5 @@ jobs: git add --all git commit -m "feat: ${LATEST_VERSION}" git push origin "$BRANCH_NAME" + gh pr create -B base_branch -H branch_to_merge --title 'feat: ${LATEST_VERSION}' --body 'This PR updates files for Minecraft version ${LATEST_VERSION}.' echo "branch=$BRANCH_NAME" >> $GITHUB_OUTPUT - - - name: Create Pull Request - if: steps.git-check.outputs.changes == 'true' && env.LATEST_VERSION != '' - uses: peter-evans/create-pull-request@v6 - with: - token: ${{ secrets.GITHUB_TOKEN }} - branch: ${{ steps.push-branch.outputs.branch }} - base: main - title: "feat: ${LATEST_VERSION}" - body: "This PR updates files for Minecraft version ${LATEST_VERSION}." From 5ddda438d7408df17e8ae69a313b26e1b26f5546 Mon Sep 17 00:00:00 2001 From: okafke <65917827+okafke@users.noreply.github.com> Date: Tue, 11 Nov 2025 15:45:03 +0100 Subject: [PATCH 06/11] chore(ci): create PR in separate step --- .github/workflows/new-mc-version.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/new-mc-version.yml b/.github/workflows/new-mc-version.yml index b691861..5ab4b48 100644 --- a/.github/workflows/new-mc-version.yml +++ b/.github/workflows/new-mc-version.yml @@ -49,5 +49,11 @@ jobs: git add --all git commit -m "feat: ${LATEST_VERSION}" git push origin "$BRANCH_NAME" - gh pr create -B base_branch -H branch_to_merge --title 'feat: ${LATEST_VERSION}' --body 'This PR updates files for Minecraft version ${LATEST_VERSION}.' echo "branch=$BRANCH_NAME" >> $GITHUB_OUTPUT + + - name: Create Pull Request + if: steps.git-check.outputs.changes == 'true' && env.LATEST_VERSION != '' + run: | + gh pr create -B base_branch -H branch_to_merge --title 'feat: ${LATEST_VERSION}' --body 'This PR updates files for Minecraft version ${LATEST_VERSION}.' + env: + token: ${{ secrets.MC_VERSION_WORKFLOW_TOKEN }} From 921e77f827c7f6453cf3d023b9cdb5346dad75a8 Mon Sep 17 00:00:00 2001 From: okafke <65917827+okafke@users.noreply.github.com> Date: Tue, 11 Nov 2025 15:47:59 +0100 Subject: [PATCH 07/11] chore(ci): fix gh CLI not using token --- .github/workflows/new-mc-version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/new-mc-version.yml b/.github/workflows/new-mc-version.yml index 5ab4b48..a7498d1 100644 --- a/.github/workflows/new-mc-version.yml +++ b/.github/workflows/new-mc-version.yml @@ -56,4 +56,4 @@ jobs: run: | gh pr create -B base_branch -H branch_to_merge --title 'feat: ${LATEST_VERSION}' --body 'This PR updates files for Minecraft version ${LATEST_VERSION}.' env: - token: ${{ secrets.MC_VERSION_WORKFLOW_TOKEN }} + GH_TOKEN: ${{ secrets.MC_VERSION_WORKFLOW_TOKEN }} From 36a1c7a4861d78eb1a3f776a438b85e0924a5afe Mon Sep 17 00:00:00 2001 From: okafke <65917827+okafke@users.noreply.github.com> Date: Tue, 11 Nov 2025 15:54:03 +0100 Subject: [PATCH 08/11] chore(ci): use create-pull-request action --- .github/workflows/new-mc-version.yml | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/.github/workflows/new-mc-version.yml b/.github/workflows/new-mc-version.yml index a7498d1..a4887d1 100644 --- a/.github/workflows/new-mc-version.yml +++ b/.github/workflows/new-mc-version.yml @@ -40,20 +40,13 @@ jobs: echo "changes=false" >> $GITHUB_OUTPUT fi - - name: Create new branch, commit and push - if: steps.git-check.outputs.changes == 'true' - id: push-branch - run: | - BRANCH_NAME="version-${LATEST_VERSION}" - git checkout -b "$BRANCH_NAME" - git add --all - git commit -m "feat: ${LATEST_VERSION}" - git push origin "$BRANCH_NAME" - echo "branch=$BRANCH_NAME" >> $GITHUB_OUTPUT - - name: Create Pull Request if: steps.git-check.outputs.changes == 'true' && env.LATEST_VERSION != '' - run: | - gh pr create -B base_branch -H branch_to_merge --title 'feat: ${LATEST_VERSION}' --body 'This PR updates files for Minecraft version ${LATEST_VERSION}.' - env: - GH_TOKEN: ${{ secrets.MC_VERSION_WORKFLOW_TOKEN }} + uses: peter-evans/create-pull-request@v7 + with: + commit-message: "feat: ${LATEST_VERSION}" + delete-branch: true + token: ${{ secrets.MC_VERSION_WORKFLOW_TOKEN }} + branch: ${{ steps.push-branch.outputs.branch }} + title: "feat: ${LATEST_VERSION}" + body: "This PR updates files for Minecraft version ${LATEST_VERSION}." From 23f1dd4bc0a81f9961dbc74c190efb2952b7876d Mon Sep 17 00:00:00 2001 From: okafke <65917827+okafke@users.noreply.github.com> Date: Tue, 11 Nov 2025 15:55:41 +0100 Subject: [PATCH 09/11] chore(ci): fix create-pull-request --- .github/workflows/new-mc-version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/new-mc-version.yml b/.github/workflows/new-mc-version.yml index a4887d1..aa376c2 100644 --- a/.github/workflows/new-mc-version.yml +++ b/.github/workflows/new-mc-version.yml @@ -47,6 +47,6 @@ jobs: commit-message: "feat: ${LATEST_VERSION}" delete-branch: true token: ${{ secrets.MC_VERSION_WORKFLOW_TOKEN }} - branch: ${{ steps.push-branch.outputs.branch }} + branch: version-${{ env.LATEST_VERSION }} title: "feat: ${LATEST_VERSION}" body: "This PR updates files for Minecraft version ${LATEST_VERSION}." From 6caf70a1daa987a020602d39cf0a77cdcf327391 Mon Sep 17 00:00:00 2001 From: okafke <65917827+okafke@users.noreply.github.com> Date: Tue, 11 Nov 2025 15:58:10 +0100 Subject: [PATCH 10/11] chore(ci): fix string interpolation --- .github/workflows/new-mc-version.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/new-mc-version.yml b/.github/workflows/new-mc-version.yml index aa376c2..148362d 100644 --- a/.github/workflows/new-mc-version.yml +++ b/.github/workflows/new-mc-version.yml @@ -44,9 +44,10 @@ jobs: if: steps.git-check.outputs.changes == 'true' && env.LATEST_VERSION != '' uses: peter-evans/create-pull-request@v7 with: - commit-message: "feat: ${LATEST_VERSION}" + author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> + commit-message: "feat: ${{ env.LATEST_VERSION }}" delete-branch: true token: ${{ secrets.MC_VERSION_WORKFLOW_TOKEN }} branch: version-${{ env.LATEST_VERSION }} - title: "feat: ${LATEST_VERSION}" - body: "This PR updates files for Minecraft version ${LATEST_VERSION}." + title: "feat: ${{ env.LATEST_VERSION }}" + body: "This PR updates files for Minecraft version ${{ env.LATEST_VERSION }}." From e69e01c3f28ce6eb4885b905c83fdae8e2da1504 Mon Sep 17 00:00:00 2001 From: okafke <65917827+okafke@users.noreply.github.com> Date: Tue, 11 Nov 2025 16:00:48 +0100 Subject: [PATCH 11/11] chore(ci): add assignees and reviewers to PR --- .github/workflows/new-mc-version.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/new-mc-version.yml b/.github/workflows/new-mc-version.yml index 148362d..98bf68c 100644 --- a/.github/workflows/new-mc-version.yml +++ b/.github/workflows/new-mc-version.yml @@ -44,7 +44,9 @@ jobs: if: steps.git-check.outputs.changes == 'true' && env.LATEST_VERSION != '' uses: peter-evans/create-pull-request@v7 with: - author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> + author: 'github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>' + assignees: [ okafke ] + reviewers: [ okafke ] commit-message: "feat: ${{ env.LATEST_VERSION }}" delete-branch: true token: ${{ secrets.MC_VERSION_WORKFLOW_TOKEN }}