Skip to content

Commit a4de210

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

File tree

1 file changed

+25
-7
lines changed

1 file changed

+25
-7
lines changed

.github/workflows/triage.yml

Lines changed: 25 additions & 7 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+
2021
while ( ( match = regex.exec( body ) ) ) {
2122
const [ , component_label ] = match;
22-
await github.rest.issues.addLabels( {
23+
24+
let label
25+
// Check if the component label is "_No response_"
26+
if (component_label.trim() === "_No response_") {
27+
// Add a comment tagging the user
28+
await github.rest.issues.createComment({
29+
owner: owner.login,
30+
repo: name,
31+
issue_number: number,
32+
body: `@${user.login} Please reply to this comment with the relevant component to ensure it gets properly triaged:\n\n- Build\n- Clients\n- Cluster Manager\n- Extensions\n- Indexing:Performance\n- Indexing:Replication\n- Indexing\n- Libraries\n- Other\n- Plugins\n- Search:Aggregations\n- Search:Performance\n- Search:Query Capabilities\n- Search:Query Insights\n- Search:Relevance\n- Search:Remote Search\n- Search:Resiliency\n- Search:Searchable Snapshots\n- Search\n- Storage:Durability\n- Storage:Performance\n- Storage:Remote\n- Storage:Snapshots\n- Storage\n\nReply with the component name, and we'll label this issue appropriately.`
33+
});
34+
label = 'missing-component'
35+
} else {
36+
label = component_label
37+
}
38+
await github.rest.issues.addLabels({
2339
owner: owner.login,
2440
repo: name,
2541
issue_number: number,
26-
labels: [ `${ component_label }` ],
27-
} );
42+
labels: [label]
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)