From 87cebe73212691f418d34dea85c41b8f15ea5a38 Mon Sep 17 00:00:00 2001 From: Pieter Viljoen Date: Sun, 5 Apr 2026 14:56:17 -0700 Subject: [PATCH 1/3] Update auto-merge conditions for codegen pull requests and enhance README documentation Signed-off-by: Pieter Viljoen --- .github/workflows/merge-bot-pull-request.yml | 2 +- .github/workflows/run-codegen-pull-request-task.yml | 1 - README.md | 6 ++---- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/merge-bot-pull-request.yml b/.github/workflows/merge-bot-pull-request.yml index 8ce8d48a..903588b3 100644 --- a/.github/workflows/merge-bot-pull-request.yml +++ b/.github/workflows/merge-bot-pull-request.yml @@ -35,7 +35,7 @@ jobs: merge-codegen: name: Merge codegen pull request job runs-on: ubuntu-latest - if: github.event.pull_request.head.ref == 'codegen' && github.event.pull_request.head.repo.full_name == github.repository && contains(github.event.pull_request.labels.*.name, 'automated-codegen') + if: github.event.pull_request.user.login == 'ptr727' && github.event.pull_request.head.ref == 'codegen' && github.event.pull_request.head.repo.full_name == github.repository permissions: contents: write pull-requests: write diff --git a/.github/workflows/run-codegen-pull-request-task.yml b/.github/workflows/run-codegen-pull-request-task.yml index 632e3c43..963ceaea 100644 --- a/.github/workflows/run-codegen-pull-request-task.yml +++ b/.github/workflows/run-codegen-pull-request-task.yml @@ -44,4 +44,3 @@ jobs: commit-message: 'Update codegen files' delete-branch: true sign-commits: true - labels: automated-codegen diff --git a/README.md b/README.md index 5c6102d0..056e913f 100644 --- a/README.md +++ b/README.md @@ -387,8 +387,9 @@ Licensed under the [MIT License][license-link]\ - Permissions: - Contents: Read & write (to push the codegen commit) - Pull requests: Read & write — to create the PR - - Workflows: Read & write — this is the key permission that allows the token to trigger pull_request events in other workflows + - Workflows: Read & write — this is the key permission that allows the token to trigger `pull_request` events in other workflows; without it the auto-merge workflow never fires - Metadata: Read-only (auto-required) + - The auto-merge condition gates on `github.event.pull_request.user.login` matching the PAT owner's GitHub username (`ptr727`), so only PRs created by this token on the `codegen` branch are eligible for auto-merge. - Save the PAT as `WORKFLOW_PAT` in: - GitHub project security Settings / Secrets / Actions. @@ -420,9 +421,6 @@ Licensed under the [MIT License][license-link]\ - `Review draft pull requests` - Actions / General: - `Allow GitHub Actions to create and approve pull requests` -- Labels: - - `https://github.com/ptr727/[project]/labels` - - Add `automated-codegen` label. ### Template - Branching Workflow From 0c2654026e7be4e616ec16373919a567b94145d4 Mon Sep 17 00:00:00 2001 From: Pieter Viljoen Date: Sun, 5 Apr 2026 15:08:34 -0700 Subject: [PATCH 2/3] Update workflow to ensure codegen pull requests merge into main and enhance README instructions Signed-off-by: Pieter Viljoen --- .github/workflows/run-codegen-pull-request-task.yml | 3 +++ README.md | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/run-codegen-pull-request-task.yml b/.github/workflows/run-codegen-pull-request-task.yml index 963ceaea..8c58bc66 100644 --- a/.github/workflows/run-codegen-pull-request-task.yml +++ b/.github/workflows/run-codegen-pull-request-task.yml @@ -21,6 +21,8 @@ jobs: - name: Checkout code step uses: actions/checkout@v6 + with: + ref: main - name: Run codegen step run: | @@ -38,6 +40,7 @@ jobs: uses: peter-evans/create-pull-request@v8 with: token: ${{ secrets.WORKFLOW_PAT }} + base: main branch: codegen title: 'Update codegen files' body: 'This PR updates the codegen files.' diff --git a/README.md b/README.md index 056e913f..c0f9193f 100644 --- a/README.md +++ b/README.md @@ -431,7 +431,8 @@ Licensed under the [MIT License][license-link]\ - Only commit to feature branches, do not commit directly to `develop` or to `main`. - Always "Squash and merge" from feature branches to the `develop` branch to minimize change history. - Always "Squash and merge" from `develop` to `main` to maintain a linear history. -- Bot generated pull requests will always merge to `main`, keep feature branches updated when merging to `develop` to merge to `main`. +- Bot generated pull requests (codegen, dependabot) always checkout from and merge into `main` directly. +- If `develop` falls behind after a bot merge, re-run codegen or rebase `develop` on `main` before merging `develop` to `main`. From 5b70fd3c6973705579956240b112c1d8e9eb977e Mon Sep 17 00:00:00 2001 From: Pieter Viljoen Date: Sun, 5 Apr 2026 15:18:18 -0700 Subject: [PATCH 3/3] Update merge-codegen job conditions to include base branch check Signed-off-by: Pieter Viljoen --- .github/workflows/merge-bot-pull-request.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/merge-bot-pull-request.yml b/.github/workflows/merge-bot-pull-request.yml index 903588b3..d0221f95 100644 --- a/.github/workflows/merge-bot-pull-request.yml +++ b/.github/workflows/merge-bot-pull-request.yml @@ -35,7 +35,7 @@ jobs: merge-codegen: name: Merge codegen pull request job runs-on: ubuntu-latest - if: github.event.pull_request.user.login == 'ptr727' && github.event.pull_request.head.ref == 'codegen' && github.event.pull_request.head.repo.full_name == github.repository + if: github.event.pull_request.user.login == 'ptr727' && github.event.pull_request.head.ref == 'codegen' && github.event.pull_request.base.ref == 'main' && github.event.pull_request.head.repo.full_name == github.repository permissions: contents: write pull-requests: write