From 1f0ba9612fbe2eff52b82ce6fc84d40a3a229d34 Mon Sep 17 00:00:00 2001 From: shikha372 Date: Mon, 12 Aug 2024 13:33:33 -0700 Subject: [PATCH] chore(template): adding regression info in the bug template (#31057) ### Issue # (if applicable) Closes . ### Reason for this change Update bug template for users to inform about the code changes that resulted in breaking changes. ### Description of changes - Adding checkbox to indicate whether this bug is a regression - Add option of an input for adding last known CDK version - Add GH workflow to run when an issue is opened or edit, workflow will add label `potential-regression` on the basis whether checkbox is selected in [issue template or not.](https://github.com/shikha372/aws-cdk/blob/regression_template/.github/ISSUE_TEMPLATE/bug-report.yml) ### Description of how you validated changes Validated template [here](https://github.com/shikha372/aws-cdk/blob/regression_template/.github/ISSUE_TEMPLATE/bug-report.yml) Label : potential-regression (will be created after approval) Label will removed if this option is unchecked and added if this option is checked. Verified with sample issue in personal repo [here](https://github.com/shikha372/aws-cdk/actions/runs/10326894628), can be tested on sample [github issue ](https://github.com/shikha372/aws-cdk/issues/2)created in personal repo. Result will be seen in [github actions](https://github.com/shikha372/aws-cdk/actions). Sample issue: https://github.com/shikha372/aws-cdk/issues/2 Sample run: https://github.com/shikha372/aws-cdk/actions/runs/10326894628/job/28591182838 ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- .github/ISSUE_TEMPLATE/bug-report.yml | 15 +++++++++ .../workflows/issue-regression-labeler.yml | 32 +++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 .github/workflows/issue-regression-labeler.yml diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml index c3843d23481d8..7512a919e56fb 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.yml +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -20,6 +20,21 @@ body: description: What is the problem? A clear and concise description of the bug. validations: required: true + - type: checkboxes + id: regression + attributes: + label: Regression Issue + description: What is a regression? If it worked in a previous version but doesn’t in the latest version, it’s considered a regression. In this case, please provide specific version number in the report. + options: + - label: Select this option if this issue appears to be a regression. + required: false + - type: input + id: working-version + attributes: + label: Last Known Working CDK Version + description: Specify the last known CDK version where this code was functioning as expected (if applicable). + validations: + required: false - type: textarea id: expected attributes: diff --git a/.github/workflows/issue-regression-labeler.yml b/.github/workflows/issue-regression-labeler.yml new file mode 100644 index 0000000000000..bd000719d101b --- /dev/null +++ b/.github/workflows/issue-regression-labeler.yml @@ -0,0 +1,32 @@ +# Apply potential regression label on issues +name: issue-regression-label +on: + issues: + types: [opened, edited] +jobs: + add-regression-label: + runs-on: ubuntu-latest + permissions: + issues: write + steps: + - name: Fetch template body + id: check_regression + uses: actions/github-script@v7 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TEMPLATE_BODY: ${{ github.event.issue.body }} + with: + script: | + const regressionPattern = /\[x\] Select this option if this issue appears to be a regression\./i; + const template = `${process.env.TEMPLATE_BODY}` + const match = regressionPattern.test(template); + core.setOutput('is_regression', match); + - name: Manage regression label + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + if [ "${{ steps.check_regression.outputs.is_regression }}" == "true" ]; then + gh issue edit ${{ github.event.issue.number }} --add-label "potential-regression" -R ${{ github.repository }} + else + gh issue edit ${{ github.event.issue.number }} --remove-label "potential-regression" -R ${{ github.repository }} + fi