From 781a1c86807ecdacd684197f3661aad3292f6662 Mon Sep 17 00:00:00 2001 From: Pierre Equoy Date: Fri, 1 Nov 2024 12:41:40 +0100 Subject: [PATCH] Automatically label issues affecting cert-blocker jobs (infra) (#1570) Automatically label issues affecting cert-blocker jobs Add a checkbox (no pun intended) in the issue template so that reporter can mention whether or not this is about a cert-blocker test case. Add a GitHub Action to automatically label the issue if this is checked. --- .github/ISSUE_TEMPLATE/bug_report.yaml | 5 +++ .../workflows/label-cert-blocker-issue.yaml | 31 +++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 .github/workflows/label-cert-blocker-issue.yaml diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml index 02bffcf4c1..7a0c5d2eb7 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -16,6 +16,11 @@ body: If applicable, add screenshots to help explain the problem you are facing. validations: required: true + - type: checkboxes + attributes: + label: Cert-blocker Test Case + options: + - label: This issue is about a test case that has the "blocker" certification status - type: textarea id: reproduction attributes: diff --git a/.github/workflows/label-cert-blocker-issue.yaml b/.github/workflows/label-cert-blocker-issue.yaml new file mode 100644 index 0000000000..977ea00474 --- /dev/null +++ b/.github/workflows/label-cert-blocker-issue.yaml @@ -0,0 +1,31 @@ +name: Label issue related to cert-blocker test cases + +on: + issues: + types: [opened] + +jobs: + label_checked_item: + runs-on: ubuntu-latest + permissions: + issues: write + + steps: + - name: Check if an issue has a ticked cert-blocker test case mark + id: check_for_cert_blocker_test_case + run: | + if echo "${{ github.event.issue.body }}" | grep -q "\[x\] Cert-blocker Test Case"; then + echo "found=true" >> $GITHUB_ENV + else + echo "found=false" >> $GITHUB_ENV + fi + + - name: Add label if cert-blocker test case mark found + if: env.found == 'true' + run: gh issue edit "$NUMBER" --add-label "$LABELS" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_REPO: ${{ github.repository }} + NUMBER: ${{ github.event.issue.number }} + LABELS: cert-blocker test case +