Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Add GH workflow to surface comments on closed bugs (#46249)

Lena754bfadb4aa1
diff --git a/.github/workflows/add_commented_closed_issue_to_project.yml b/.github/workflows/add_commented_closed_issue_to_project.yml
new file mode 100644
index 00000000000..45b3790d361
--- /dev/null
+++ b/.github/workflows/add_commented_closed_issue_to_project.yml
@@ -0,0 +1,49 @@
+name: "Surface closed issues someone's commented on"
+
+on:
+ issue_comment:
+ types:
+ - created
+
+jobs:
+ add-to-project:
+ if: >
+ github.repository == 'zed-industries/zed' &&
+ github.event.issue.state == 'closed' &&
+ github.event.issue.type.name == 'Bug' &&
+ github.event.comment.user.type != 'Bot'
+ runs-on: ubuntu-latest
+ steps:
+ - id: get-app-token
+ uses: actions/create-github-app-token@df432ccc7b4c53164ccb55b2c30ff6705e2ffc81 # v1.11.7
+ with:
+ app-id: ${{ secrets.ZED_COMMUNITY_BOT_APP_ID }}
+ private-key: ${{ secrets.ZED_COMMUNITY_BOT_PRIVATE_KEY }}
+ owner: zed-industries
+
+ - id: check-staff
+ uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
+ with:
+ github-token: ${{ steps.get-app-token.outputs.token }}
+ script: |
+ try {
+ const response = await github.rest.teams.getMembershipForUserInOrg({
+ org: 'zed-industries',
+ team_slug: 'staff',
+ username: context.payload.comment.user.login
+ });
+ return response.data.state === 'active';
+ } catch (error) {
+ // 404 means user is not a member
+ if (error.status === 404) {
+ return false;
+ }
+ throw error;
+ }
+
+ # Add to the support team's board for triage
+ - if: steps.check-staff.outputs.result == 'false'
+ uses: actions/add-to-project@244f685bbc3b7adfa8466e08b698b5577571133e # v1.0.2
+ with:
+ project-url: https://github.com/orgs/zed-industries/projects/71
+ github-token: ${{ steps.get-app-token.outputs.token }}