Skip to content

Commit

Permalink
Add auto triage workflow
Browse files Browse the repository at this point in the history
Signed-off-by: bowenlan-amzn <[email protected]>
  • Loading branch information
bowenlan-amzn committed Nov 14, 2023
1 parent ec56d57 commit 8ea2a6b
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 7 deletions.
5 changes: 2 additions & 3 deletions .github/ISSUE_TEMPLATE/bug_template.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: 🐛 Bug report
description: Create a report to help us improve
title: "[BUG] <title>"
labels: ['bug, untriaged']
labels: ['bug']
body:
- type: textarea
attributes:
Expand All @@ -11,7 +11,7 @@ body:
required: true
- type: dropdown
attributes:
label: Choose the related component
label: Related component
description: Choose one specific OpenSearch component your problem belongs to.
multiple: false
options:
Expand All @@ -36,7 +36,6 @@ body:
- Extensions
- Build Libraries & Interfaces
- Plugins
- Others
validations:
required: true
- type: textarea
Expand Down
7 changes: 3 additions & 4 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: 🎆 Feature request
description: Suggest an idea for this project
title: '[Feature Request] <title>'
labels: ['enhancement, untriaged']
labels: ['enhancement']
body:
- type: textarea
attributes:
Expand All @@ -18,8 +18,8 @@ body:
required: true
- type: dropdown
attributes:
label: Choose the related component
description: Choose one specific OpenSearch component your problem belongs to.
label: Related component
description: Choose one specific OpenSearch component your feature request belongs to.
multiple: false
options:
- Search:Resiliency
Expand All @@ -43,7 +43,6 @@ body:
- Extensions
- Build Libraries & Interfaces
- Plugins
- Others
validations:
required: true
- type: textarea
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/triage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Auto triage based on the component label in issue
on:
issues:
types: [opened, reopened, transferred]

jobs:
triage:
if: github.repository == 'opensearch-project/OpenSearch'
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v7
with:
script: |
const { issue, repository } = context.payload;
const { number, body } = issue;
const { owner, name } = repository;
const regex = /###\sRelated\scomponent\n\n(\w*)\n/gm;
let match;
while ( ( match = regex.exec( body ) ) ) {
const [ , component_label ] = match;
await github.rest.issues.addLabels( {
owner: owner.login,
repo: name,
issue_number: number,
labels: [ `${ component_label }` ],
} );
}

0 comments on commit 8ea2a6b

Please sign in to comment.