Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/merge-bot-pull-request.yml
Original file line numberDiff line numberDiff line change
Expand Up@@ -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.base.ref == 'main' && github.event.pull_request.head.repo.full_name == github.repository
permissions:
contents: write
pull-requests: write
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/run-codegen-pull-request-task.yml
Original file line numberDiff line numberDiff line change
Expand Up@@ -21,6 +21,8 @@ jobs:

- name: Checkout code step
uses: actions/checkout@v6
with:
ref: main

- name: Run codegen step
run: |
Expand All@@ -38,10 +40,10 @@ 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.'
commit-message: 'Update codegen files'
delete-branch: true
sign-commits: true
labels: automated-codegen
9 changes: 4 additions & 5 deletions README.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -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.
Comment thread
ptr727 marked this conversation as resolved.
- Save the PAT as `WORKFLOW_PAT` in:
- GitHub project security Settings / Secrets / Actions.

Expand DownExpand Up@@ -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

Expand All@@ -433,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`.

<!--- Shields links --->

Expand Down
Loading