File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change
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
+ });
You can’t perform that action at this time.
0 commit comments