Skip to content

Commit 35009b9

Browse files
authored
[CI] Auto labeller more fixes (#5127)
1 parent 300d25d commit 35009b9

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

.github/workflows/auto-label-pr.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ jobs:
3737

3838
- name: Auto Label PR
3939
uses: actions/[email protected]
40+
env:
41+
PR_NUMBER: ${{ github.event.inputs.pr_number || github.event.number }}
4042
with:
4143
github-token: ${{ steps.generate-token.outputs.token }}
4244
script: |
4345
const { owner, repo } = context.repo;
44-
const pr_number = github.event_name === 'workflow_dispatch'
45-
? ${{ github.event.inputs.pr_number }}
46-
: context.issue.number;
46+
const pr_number = parseInt(process.env.PR_NUMBER);
4747
4848
console.log('Processing PR #' + pr_number);
4949
@@ -74,7 +74,7 @@ jobs:
7474
7575
// Strategy: Branch-based labeling
7676
let baseRef, prBody;
77-
if (github.event_name === 'workflow_dispatch') {
77+
if (process.env.PR_NUMBER !== context.issue.number.toString()) {
7878
// Get PR details when called via workflow_dispatch
7979
const { data: pr } = await github.rest.pulls.get({
8080
owner,
@@ -199,7 +199,7 @@ jobs:
199199
// Find the most recent review from this bot that requested changes for wrong base branch
200200
const botReview = reviews
201201
.filter(review =>
202-
review.user.login === '${{ env.BOT_NAME }}' &&
202+
review.user.login === process.env.BOT_NAME &&
203203
review.state === 'CHANGES_REQUESTED' &&
204204
review.body && review.body.includes('target your PR to the `next` branch')
205205
)

.github/workflows/labeller-recheck.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ jobs:
2828
workflow_id: 'auto-label-pr.yml',
2929
ref: context.payload.pull_request.base.ref,
3030
inputs: {
31-
pr_number: context.payload.pull_request.number
31+
pr_number: context.payload.pull_request.number.toString()
3232
}
3333
});

0 commit comments

Comments
 (0)