Skip to content

Commit 4cfde9e

Browse files
authored
[CI] Fix label race condition between LabelPrs and pr-bot-pr-updates (apache#40141)
1 parent 480a438 commit 4cfde9e

3 files changed

Lines changed: 10 additions & 3 deletions

File tree

.github/workflows/label_prs.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
name: LabelPrs
2020
on: [pull_request_target]
2121
permissions: read-all
22+
concurrency:
23+
group: pr-bot-labels-${{ github.event.pull_request.number || github.event.issue.number }}
24+
cancel-in-progress: false
2225
jobs:
2326
label:
2427
runs-on: ubuntu-latest

.github/workflows/pr-bot-pr-updates.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ on:
2020
issue_comment:
2121
types: [created]
2222
permissions: read-all
23+
concurrency:
24+
group: pr-bot-labels-${{ github.event.pull_request.number || github.event.issue.number }}
25+
cancel-in-progress: false
2326
jobs:
2427
process-pr-update:
2528
# Give GITHUB_TOKEN permissions to write pull request comments and to the state branch, and read PR related info
@@ -30,8 +33,8 @@ jobs:
3033
issues: read
3134
statuses: read
3235

33-
# Don't run on forks
34-
if: github.repository == 'apache/beam'
36+
# Don't run on forks or non-PR issue comments
37+
if: github.repository == 'apache/beam' && (github.event_name != 'issue_comment' || github.event.issue.pull_request)
3538
runs-on: ubuntu-latest
3639

3740
steps:

scripts/ci/pr-bot/processPrUpdate.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ async function setNextActionReviewers(
138138
console.log("No reviewers assigned, dont need to manipulate attention set");
139139
return;
140140
}
141-
const existingLabels = payload.issue?.labels || payload.pull_request?.labels;
141+
const existingLabels =
142+
pull.labels || payload.issue?.labels || payload.pull_request?.labels;
142143
await nextActionReviewers(pull.number, existingLabels);
143144
let prState = await stateClient.getPrState(pull.number);
144145
prState.nextAction = REVIEWERS_ACTION;

0 commit comments

Comments
 (0)