Skip to content

Commit daface1

Browse files
authored
Create add_label.yml
1 parent 67eb5e0 commit daface1

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

.github/workflows/add_label.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Add Label to Pull Requests
2+
3+
on:
4+
pull_request:
5+
types: [opened]
6+
7+
jobs:
8+
add-label:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Add PR Review in Progress Label
12+
uses: actions/github-script@v5
13+
with:
14+
github-token: ${{ secrets.GITHUB_TOKEN }}
15+
script: |
16+
const labelName = 'PR Review in Progress';
17+
const { data: labels } = await github.issues.listLabelsForRepo({
18+
owner: context.repo.owner,
19+
repo: context.repo.repo
20+
});
21+
const labelExists = labels.some(label => label.name === labelName);
22+
if (!labelExists) {
23+
await github.issues.createLabel({
24+
owner: context.repo.owner,
25+
repo: context.repo.repo,
26+
name: labelName,
27+
color: '3498DB'
28+
});
29+
}
30+
await github.issues.addLabels({
31+
owner: context.repo.owner,
32+
repo: context.repo.repo,
33+
issue_number: context.issue.number,
34+
labels: [labelName]
35+
});

0 commit comments

Comments
 (0)