File tree 2 files changed +37
-0
lines changed
2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Autofix Label Manager
2
+
3
+ on :
4
+ pull_request_target :
5
+ types : [labeled]
6
+
7
+ jobs :
8
+ check-to-remove-autofix-label :
9
+ env :
10
+ GITHUB_REPOSITORY : ${{ github.repository }}
11
+ PR_NUMBER : ${{ github.event.number }}
12
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
13
+ REQUIRES_AUTOFIX_LABEL : " Autofix Validation Required"
14
+ DOES_NOT_REQUIRE_AUTOFIX_LABEL : " No Autofix Validation Required"
15
+ LABEL_ADDED : ${{ github.event.label.name }}
16
+
17
+ runs-on : ubuntu-latest
18
+ steps :
19
+ - name : Check if label "No Autofix Validation Required" is added
20
+ shell : bash
21
+ run : |
22
+ if [ "$LABEL_ADDED" != "$DOES_NOT_REQUIRE_AUTOFIX_LABEL" ]; then
23
+ echo "Label $DOES_NOT_REQUIRE_AUTOFIX_LABEL was not added."
24
+ exit 0
25
+ fi
26
+
27
+ echo "Label $DOES_NOT_REQUIRE_AUTOFIX_LABEL was added."
28
+
29
+ # Check if Label $REQUIRES_AUTOFIX_LABEL exists and remove it
30
+ REQUIRES_AUTOFIX_LABEL_EXISTS=$(gh api /repos/$GITHUB_REPOSITORY/issues/$PR_NUMBER/labels | jq --arg label "Autofix Validation Required" '.[] | select(.name==$label) | .name')
31
+ if [ "$REQUIRES_AUTOFIX_LABEL_EXISTS" == "$REQUIRES_AUTOFIX_LABEL" ]; then
32
+ gh api -X DELETE "/repos/$GITHUB_REPOSITORY/issues/$PR_NUMBER/labels/$REQUIRES_AUTOFIX_LABEL"
33
+ echo "$REQUIRES_AUTOFIX_LABEL Label removed."
34
+ else
35
+ echo "$REQUIRES_AUTOFIX_LABEL Label does not exist or was already removed."
36
+ fi
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ permissions:
8
8
issues : write
9
9
10
10
on :
11
+ workflow_dispatch :
11
12
pull_request :
12
13
branches :
13
14
- main
You can’t perform that action at this time.
0 commit comments