31
31
- review_request_removed
32
32
- ready_for_review
33
33
- converted_to_draft
34
+ - labeled
34
35
35
36
# Workflow jobs:
36
37
jobs :
75
76
'owner': context.repo.owner,
76
77
'repo': context.repo.repo,
77
78
'issue_number': context.payload.pull_request.number,
78
- 'labels': ['Needs Review'],
79
+ 'labels': [ 'Needs Review' ]
79
80
})
80
81
81
82
# Add "Needs Review" label when PR is marked ready for review:
90
91
'owner': context.repo.owner,
91
92
'repo': context.repo.repo,
92
93
'issue_number': context.payload.pull_request.number,
93
- 'labels': ['Needs Review'],
94
+ 'labels': [ 'Needs Review' ]
94
95
})
95
96
96
97
# Remove "Needs Review" label when PR is converted to draft or closed:
@@ -106,8 +107,29 @@ jobs:
106
107
'owner': context.repo.owner,
107
108
'repo': context.repo.repo,
108
109
'issue_number': context.payload.pull_request.number,
109
- 'name': 'Needs Review',
110
+ 'name': 'Needs Review'
110
111
})
111
112
} catch ( error ) {
112
113
console.log( 'Error removing label: %s', error.message );
113
114
}
115
+
116
+ # Remove "Needs Review" and "Needs Changes" labels when "Ready To Merge" is assigned:
117
+ - name : ' Remove "Needs Review" and "Needs Changes" labels when "Ready To Merge" is assigned'
118
+ if : ${{ github.event.action == 'labeled' && github.event.label.name == 'Ready To Merge' }}
119
+ uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
120
+ with :
121
+ github-token : ${{ secrets.CHATBOT_GITHUB_TOKEN }}
122
+ script : |
123
+ const labelsToRemove = [ 'Needs Review', 'Needs Changes' ];
124
+ for ( const label of labelsToRemove ) {
125
+ try {
126
+ await github.rest.issues.removeLabel({
127
+ 'owner': context.repo.owner,
128
+ 'repo': context.repo.repo,
129
+ 'issue_number': context.payload.pull_request.number,
130
+ 'name': label
131
+ })
132
+ } catch ( error ) {
133
+ console.log( 'Error removing label %s: %s', label, error.message );
134
+ }
135
+ }
0 commit comments