Skip to content

Commit 381e840

Browse files
marthakellyclaude
andcommitted
ci: add workflow to update PR branch via qa:update-branch label
Triggers on the qa:update-branch label being added to a PR, calls the GitHub update-branch API to merge the base into the PR, and removes the label so it can be re-applied. Enables the QA bot to keep PRs current without human intervention. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent a6bc1ef commit 381e840

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Update PR branch
2+
3+
on:
4+
pull_request:
5+
types: [labeled]
6+
7+
permissions:
8+
contents: write
9+
pull-requests: write
10+
11+
jobs:
12+
update-branch:
13+
if: github.event.label.name == 'qa:update-branch'
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Update PR branch with base
17+
uses: actions/github-script@v7
18+
with:
19+
script: |
20+
const { owner, repo } = context.repo;
21+
const pull_number = context.payload.pull_request.number;
22+
23+
try {
24+
await github.rest.pulls.updateBranch({ owner, repo, pull_number });
25+
core.info(`Updated branch for PR #${pull_number}`);
26+
} catch (error) {
27+
core.setFailed(`Failed to update branch: ${error.message}`);
28+
throw error;
29+
} finally {
30+
try {
31+
await github.rest.issues.removeLabel({
32+
owner,
33+
repo,
34+
issue_number: pull_number,
35+
name: 'qa:update-branch',
36+
});
37+
} catch (error) {
38+
core.warning(`Could not remove label: ${error.message}`);
39+
}
40+
}

0 commit comments

Comments
 (0)