From f5d2ab0629df27d52189c2e17b7aebfbb98fd5df Mon Sep 17 00:00:00 2001 From: Matty Widdop <18513864+MattyTheHacker@users.noreply.github.com> Date: Mon, 9 Jun 2025 07:15:51 +0100 Subject: [PATCH 1/6] Automatically label PRs to sync by default Signed-off-by: Matty Widdop <18513864+MattyTheHacker@users.noreply.github.com> --- .github/workflows/pr-auto-label.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .github/workflows/pr-auto-label.yml diff --git a/.github/workflows/pr-auto-label.yml b/.github/workflows/pr-auto-label.yml new file mode 100644 index 00000000..ff1493d4 --- /dev/null +++ b/.github/workflows/pr-auto-label.yml @@ -0,0 +1,16 @@ +name: "Automatically mark PRs to sync" + +on: + pull_request: + +jobs: + labeler: + permissions: + pull-requests: write + + runs-on: ubuntu-latest + steps: + - run: gh pr edit $PR --add-label sync + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR: ${{ github.event.number }} From 4e3d2779164d50213264b287a6ebda09602925c5 Mon Sep 17 00:00:00 2001 From: Matty Widdop <18513864+MattyTheHacker@users.noreply.github.com> Date: Mon, 9 Jun 2025 07:18:25 +0100 Subject: [PATCH 2/6] Update pr-auto-label.yml Signed-off-by: Matty Widdop <18513864+MattyTheHacker@users.noreply.github.com> --- .github/workflows/pr-auto-label.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pr-auto-label.yml b/.github/workflows/pr-auto-label.yml index ff1493d4..8dce74c5 100644 --- a/.github/workflows/pr-auto-label.yml +++ b/.github/workflows/pr-auto-label.yml @@ -2,6 +2,8 @@ name: "Automatically mark PRs to sync" on: pull_request: + types: + - opened jobs: labeler: From 18c4e9da9e326de3c692282d1aec7ef46d378bdf Mon Sep 17 00:00:00 2001 From: Matty Widdop <18513864+MattyTheHacker@users.noreply.github.com> Date: Mon, 9 Jun 2025 07:21:36 +0100 Subject: [PATCH 3/6] Update pr-auto-label.yml Signed-off-by: Matty Widdop <18513864+MattyTheHacker@users.noreply.github.com> --- .github/workflows/pr-auto-label.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-auto-label.yml b/.github/workflows/pr-auto-label.yml index 8dce74c5..2113af11 100644 --- a/.github/workflows/pr-auto-label.yml +++ b/.github/workflows/pr-auto-label.yml @@ -12,7 +12,14 @@ jobs: runs-on: ubuntu-latest steps: - - run: gh pr edit $PR --add-label sync + - name: Add "sync" label to PR + run: gh pr edit "$PR_URL" --add-label sync env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - PR: ${{ github.event.number }} + PR_URL: ${{ github.event.pull_request.html_url }} + + - name: Comment on PR to explain sync label + run: gh pr comment "$PR_URL" --body "This pull request has been marked to **automatically sync** to its base branch. You can **disable** this behavior by removing the `sync` label." + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_URL: ${{ github.event.pull_request.html_url }} From cfbfec81ce79e041b34e48778a67004db67c4f95 Mon Sep 17 00:00:00 2001 From: Matty Widdop <18513864+MattyTheHacker@users.noreply.github.com> Date: Mon, 9 Jun 2025 07:31:52 +0100 Subject: [PATCH 4/6] Update pr-auto-label.yml Signed-off-by: Matty Widdop <18513864+MattyTheHacker@users.noreply.github.com> --- .github/workflows/pr-auto-label.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr-auto-label.yml b/.github/workflows/pr-auto-label.yml index 2113af11..c84f50eb 100644 --- a/.github/workflows/pr-auto-label.yml +++ b/.github/workflows/pr-auto-label.yml @@ -7,6 +7,7 @@ on: jobs: labeler: + if: github.event.pull_request.user.type != 'Bot' permissions: pull-requests: write From 0777652a6512d22de2fb8ff91177b87b31c96c2d Mon Sep 17 00:00:00 2001 From: Matty Widdop <18513864+MattyTheHacker@users.noreply.github.com> Date: Wed, 11 Jun 2025 14:15:36 +0100 Subject: [PATCH 5/6] Create pr-auto-merge.yaml Signed-off-by: Matty Widdop <18513864+MattyTheHacker@users.noreply.github.com> --- .github/workflows/pr-auto-merge.yaml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/pr-auto-merge.yaml diff --git a/.github/workflows/pr-auto-merge.yaml b/.github/workflows/pr-auto-merge.yaml new file mode 100644 index 00000000..1773d84f --- /dev/null +++ b/.github/workflows/pr-auto-merge.yaml @@ -0,0 +1,23 @@ +name: "Automatically enable auto-merge on PRs" + +on: + pull_request_target: + types: + - opened + - ready_for_review + branches: + - main + +jobs: + enable-automerge: + if: github.event.pull_request.draft == false + permissions: + pull-requests: write + + runs-on: ubuntu-latest + steps: + - name: Enable auto-merge for the PR + run: gh pr merge "$PR_URL" --auto --squash + env: + GH_TOKEN: ${{ secrets.PR_AUTO_UPDATE_TOKEN }} + PR_URL: ${{ github.event.pull_request.html_url }} From 19023ea29a9b7cb9775a90cf1770d7436428a7e3 Mon Sep 17 00:00:00 2001 From: Matty Widdop <18513864+MattyTheHacker@users.noreply.github.com> Date: Wed, 11 Jun 2025 14:19:36 +0100 Subject: [PATCH 6/6] Rename pr-auto-merge.yaml to pr-auto-merge.yml Signed-off-by: Matty Widdop <18513864+MattyTheHacker@users.noreply.github.com> --- .github/workflows/{pr-auto-merge.yaml => pr-auto-merge.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{pr-auto-merge.yaml => pr-auto-merge.yml} (100%) diff --git a/.github/workflows/pr-auto-merge.yaml b/.github/workflows/pr-auto-merge.yml similarity index 100% rename from .github/workflows/pr-auto-merge.yaml rename to .github/workflows/pr-auto-merge.yml