Skip to content

Commit 4069599

Browse files
authored
Merge pull request #515 from chaodu-agent/feat/pending-screening-workflow
feat: auto-label new PRs with pending-screening
2 parents 7fb27af + 2c7011d commit 4069599

1 file changed

Lines changed: 48 additions & 0 deletions

File tree

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: PR Pending Screening
2+
on:
3+
pull_request_target:
4+
types: [opened, reopened]
5+
workflow_dispatch:
6+
inputs:
7+
pr_number:
8+
description: "PR number to add pending-screening label"
9+
required: true
10+
type: number
11+
12+
permissions: {}
13+
14+
jobs:
15+
add-label:
16+
if: github.event.pull_request.draft == false || github.event_name == 'workflow_dispatch'
17+
runs-on: ubuntu-latest
18+
permissions:
19+
pull-requests: write
20+
steps:
21+
- uses: actions/github-script@v7
22+
with:
23+
script: |
24+
const prNumber = context.payload.pull_request?.number || ${{ github.event.inputs.pr_number || 0 }};
25+
if (!prNumber) {
26+
core.setFailed('No PR number found');
27+
return;
28+
}
29+
30+
// Ensure label exists
31+
try {
32+
await github.rest.issues.createLabel({
33+
...context.repo,
34+
name: 'pending-screening',
35+
color: 'fbca04',
36+
description: 'PR awaiting automated screening'
37+
});
38+
core.info('Created pending-screening label');
39+
} catch (e) {
40+
if (e.status !== 422) throw e; // 422 = already exists
41+
}
42+
43+
await github.rest.issues.addLabels({
44+
...context.repo,
45+
issue_number: prNumber,
46+
labels: ['pending-screening']
47+
});
48+
core.info(`Added pending-screening to #${prNumber}`);

0 commit comments

Comments
 (0)