Browse Source

ci: automation for issue triage board (#39464)

David Sanders 1 year ago
parent
commit
dbff7bb531

+ 1 - 0
.github/ISSUE_TEMPLATE/bug_report.yml

@@ -2,6 +2,7 @@ name: Bug Report
 description: Report an Electron bug
 title: "[Bug]: "
 labels: "bug :beetle:"
+projects: ["electron/90"]
 body:
 - type: checkboxes
   attributes:

+ 24 - 1
.github/workflows/issue-labeled.yml

@@ -8,7 +8,30 @@ permissions:  # added using https://github.com/step-security/secure-workflows
   contents: read
 
 jobs:
-  issue-labeled:
+  issue-labeled-blocked:
+    name: blocked/* label added
+    if: startsWith(github.event.label.name, 'blocked/')
+    runs-on: ubuntu-latest
+    steps:
+      - name: Generate GitHub App token
+        id: generate-token
+        env:
+          RELEASE_BOARD_GH_APP_CREDS: ${{ secrets.RELEASE_BOARD_GH_APP_CREDS }}
+        run: |
+          set -eo pipefail
+          TOKEN=$(npx @electron/github-app-auth --creds=$RELEASE_BOARD_GH_APP_CREDS --org electron)
+          echo "TOKEN=$TOKEN" >> "$GITHUB_OUTPUT"
+      - name: Set status
+        if: ${{ steps.generate-token.outputs.TOKEN }}
+        uses: github/update-project-action@2d475e08804f11f4022df7e21f5816531e97cb64 # v2
+        with:
+          github_token: ${{ steps.generate-token.outputs.TOKEN }}
+          organization: electron
+          project_number: 90
+          content_id: ${{ github.event.issue.node_id }}
+          field: Status
+          value: 🛑 Blocked
+  issue-labeled-blocked-need-repro:
     name: blocked/need-repro label added
     if: github.event.label.name == 'blocked/need-repro'
     permissions:

+ 42 - 0
.github/workflows/issue-unlabeled.yml

@@ -0,0 +1,42 @@
+name: Issue Unlabeled
+
+on:
+  issues:
+    types: [unlabeled]
+
+permissions:
+  contents: read
+
+jobs:
+  issue-unlabeled-blocked:
+    name: All blocked/* labels removed
+    if: startsWith(github.event.label.name, 'blocked/')
+    runs-on: ubuntu-latest
+    steps:
+      - name: Check for any blocked labels
+        id: check-for-blocked-labels
+        run: |
+          set -eo pipefail
+          BLOCKED_LABEL_COUNT=$(echo '${{ toJSON(github.event.issue.labels.*.name) }}' | jq '[ .[] | select(startswith("blocked/")) ] | length')
+          if [[ $BLOCKED_LABEL_COUNT -eq 0 ]]; then
+            echo "NOT_BLOCKED=1" >> "$GITHUB_OUTPUT"
+          fi
+      - name: Generate GitHub App token
+        if: ${{ steps.check-for-blocked-labels.outputs.NOT_BLOCKED }}
+        id: generate-token
+        env:
+          RELEASE_BOARD_GH_APP_CREDS: ${{ secrets.RELEASE_BOARD_GH_APP_CREDS }}
+        run: |
+          set -eo pipefail
+          TOKEN=$(npx @electron/github-app-auth --creds=$RELEASE_BOARD_GH_APP_CREDS --org electron)
+          echo "TOKEN=$TOKEN" >> "$GITHUB_OUTPUT"
+      - name: Set status
+        if: ${{ steps.generate-token.outputs.TOKEN }}
+        uses: github/update-project-action@2d475e08804f11f4022df7e21f5816531e97cb64 # v2
+        with:
+          github_token: ${{ steps.generate-token.outputs.TOKEN }}
+          organization: electron
+          project_number: 90
+          content_id: ${{ github.event.issue.node_id }}
+          field: Status
+          value: 📥 Was Blocked