diff --git a/.github/ISSUE_TEMPLATE/bug_template.yml b/.github/ISSUE_TEMPLATE/bug_template.yml index f2c3b0837c04f..8bb30192524cb 100644 --- a/.github/ISSUE_TEMPLATE/bug_template.yml +++ b/.github/ISSUE_TEMPLATE/bug_template.yml @@ -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: diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index 4cf0f51dc91d9..d90de1c67207e 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -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 diff --git a/.github/workflows/triage.yml b/.github/workflows/triage.yml new file mode 100644 index 0000000000000..be1dede36cf58 --- /dev/null +++ b/.github/workflows/triage.yml @@ -0,0 +1,28 @@ +name: Auto triage based on the component label in issue + +on: + issues: + types: [opened] + +jobs: + apply-label: + 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 }` ], + } ); + }