From 8ea2a6b66f2b05956fbd9e0de8d365830496d3fe Mon Sep 17 00:00:00 2001 From: bowenlan-amzn Date: Mon, 13 Nov 2023 17:16:05 -0800 Subject: [PATCH] Add auto triage workflow Signed-off-by: bowenlan-amzn --- .github/ISSUE_TEMPLATE/bug_template.yml | 5 ++-- .github/ISSUE_TEMPLATE/feature_request.yml | 7 +++--- .github/workflows/triage.yml | 27 ++++++++++++++++++++++ 3 files changed, 32 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/triage.yml diff --git a/.github/ISSUE_TEMPLATE/bug_template.yml b/.github/ISSUE_TEMPLATE/bug_template.yml index f2c3b0837c04f..c3b6e92dbb38f 100644 --- a/.github/ISSUE_TEMPLATE/bug_template.yml +++ b/.github/ISSUE_TEMPLATE/bug_template.yml @@ -1,7 +1,7 @@ name: 🐛 Bug report description: Create a report to help us improve title: "[BUG] " -labels: ['bug, untriaged'] +labels: ['bug'] body: - type: textarea attributes: @@ -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: @@ -36,7 +36,6 @@ body: - Extensions - Build Libraries & Interfaces - Plugins - - Others validations: required: true - type: textarea diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index 4cf0f51dc91d9..ab57d2d690a2a 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -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: @@ -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 @@ -43,7 +43,6 @@ body: - Extensions - Build Libraries & Interfaces - Plugins - - Others validations: required: true - type: textarea diff --git a/.github/workflows/triage.yml b/.github/workflows/triage.yml new file mode 100644 index 0000000000000..63a23701b86f0 --- /dev/null +++ b/.github/workflows/triage.yml @@ -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 }` ], + } ); + }