|
6 | 6 |
|
7 | 7 | jobs: |
8 | 8 | apply-label: |
9 | | - if: github.repository == 'opensearch-project/OpenSearch' |
| 9 | + if: github.repository == 'andrross/OpenSearch' |
10 | 10 | runs-on: ubuntu-latest |
11 | 11 | steps: |
12 | 12 | - uses: actions/github-script@v8 |
13 | 13 | with: |
14 | 14 | script: | |
15 | 15 | const { issue, repository } = context.payload; |
16 | | - const { number, body } = issue; |
| 16 | + const { number, body, user } = issue; |
17 | 17 | const { owner, name } = repository; |
18 | 18 | const regex = /###\sRelated\scomponent\n\n(\w.*)\n/gm; |
19 | 19 | let match; |
| 20 | + let hasNoResponse = false; |
| 21 | +
|
20 | 22 | while ( ( match = regex.exec( body ) ) ) { |
21 | 23 | 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 | + } |
28 | 44 | } |
29 | | - github.rest.issues.addLabels({ |
| 45 | +
|
| 46 | + // Always add the untriaged label |
| 47 | + await github.rest.issues.addLabels({ |
30 | 48 | issue_number: context.issue.number, |
31 | 49 | owner: context.repo.owner, |
32 | 50 | repo: context.repo.repo, |
33 | 51 | labels: ['untriaged'] |
34 | | - }) |
| 52 | + }); |
0 commit comments