File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Label Issues Awaiting User Response
2
+
3
+ on :
4
+ issue_comment :
5
+ types : [created]
6
+
7
+ jobs :
8
+ label-waiting-response :
9
+ runs-on : ubuntu-latest
10
+ steps :
11
+ - name : Check if commenter is a maintainer
12
+ uses : actions/github-script@v6
13
+ with :
14
+ github-token : ${{ secrets.GITHUB_TOKEN }}
15
+ script : |
16
+ const issue = context.issue;
17
+ const commentAuthor = context.payload.comment.user.login;
18
+
19
+ // Get all repository collaborators with 'maintain' or higher permissions
20
+ const collaborators = await github.repos.listCollaborators({
21
+ owner: issue.owner,
22
+ repo: issue.repo,
23
+ affiliation: 'direct',
24
+ });
25
+
26
+ // Check if the comment author is a collaborator with maintainer permissions
27
+ const isMaintainer = collaborators.data.some(collab =>
28
+ collab.login === commentAuthor && (collab.permissions.maintain || collab.permissions.admin)
29
+ );
30
+
31
+ if (isMaintainer) {
32
+ // Apply 'waiting-for-response' label if not already present
33
+ const labels = await github.issues.listLabelsOnIssue({
34
+ ...issue,
35
+ });
36
+ const hasLabel = labels.data.some(label => label.name === 'waiting-for-response');
37
+
38
+ if (!hasLabel) {
39
+ await github.issues.addLabels({
40
+ ...issue,
41
+ labels: ['waiting-for-response'],
42
+ });
43
+ }
44
+ }
You can’t perform that action at this time.
0 commit comments