Skip to content

Commit af6ca3b

Browse files
committed
Testing triage label workflow
Signed-off-by: Andrew Ross <andrross@amazon.com>
1 parent af1ecd3 commit af6ca3b

File tree

1 file changed

+28
-10
lines changed

1 file changed

+28
-10
lines changed

.github/workflows/triage.yml

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,47 @@ on:
66

77
jobs:
88
apply-label:
9-
if: github.repository == 'opensearch-project/OpenSearch'
9+
if: github.repository == 'andrross/OpenSearch'
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/github-script@v8
1313
with:
1414
script: |
1515
const { issue, repository } = context.payload;
16-
const { number, body } = issue;
16+
const { number, body, user } = issue;
1717
const { owner, name } = repository;
1818
const regex = /###\sRelated\scomponent\n\n(\w.*)\n/gm;
1919
let match;
20+
let hasNoResponse = false;
21+
2022
while ( ( match = regex.exec( body ) ) ) {
2123
const [ , component_label ] = match;
22-
await github.rest.issues.addLabels( {
23-
owner: owner.login,
24-
repo: name,
25-
issue_number: number,
26-
labels: [ `${ component_label }` ],
27-
} );
24+
25+
// Check if the component label is "_No Response_"
26+
if (component_label.trim() === "_No Response_") {
27+
hasNoResponse = true;
28+
// Add a comment tagging the user
29+
await github.rest.issues.createComment({
30+
owner: owner.login,
31+
repo: name,
32+
issue_number: number,
33+
body: `@${user.login} Please choose a component from the dropdown menu to ensure this issue gets properly triaged. Please edit your issue and select the appropriate component.`
34+
});
35+
} else {
36+
// Only add the label if it's not "_No Response_"
37+
await github.rest.issues.addLabels( {
38+
owner: owner.login,
39+
repo: name,
40+
issue_number: number,
41+
labels: [ `${ component_label }` ],
42+
} );
43+
}
2844
}
29-
github.rest.issues.addLabels({
45+
46+
// Always add the untriaged label
47+
await github.rest.issues.addLabels({
3048
issue_number: context.issue.number,
3149
owner: context.repo.owner,
3250
repo: context.repo.repo,
3351
labels: ['untriaged']
34-
})
52+
});

0 commit comments

Comments
 (0)