Skip to repository content

tenant.openagents/omega

No repository description is available.

OpenAgents Git authority 2026-07-28T03:53:49.544Z Public web read
NIP-34 coordinate30617:7649603503856e5148d571eac2766b288a8ff1e9e35d380337a1d2b0015b4f92:omega
MaintainersHidden in public view
References2 branches · 1 tag
Read-only clonegit clone https://openagents.com/git/tenant.openagents/omega.git
Browse files

add_commented_closed_issue_to_project.yml

87 lines · 3.5 KB · yaml
1name: "Surface closed issues someone's commented on"
2
3on:
4  issue_comment:
5    types:
6      - created
7
8permissions:
9  contents: read
10
11jobs:
12  add-to-project:
13    if: >
14      github.repository == 'zed-industries/zed' &&
15      github.event.issue.state == 'closed' &&
16      github.event.issue.pull_request == null &&
17      github.event.issue.type != null &&
18      github.event.issue.type.name == 'Bug' &&
19      github.event.comment.user.type != 'Bot'
20    runs-on: namespace-profile-2x4-ubuntu-2404
21    timeout-minutes: 5
22    steps:
23      - id: is-post-close-comment
24        uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
25        with:
26          script: |
27            const closedAt = new Date(context.payload.issue.closed_at);
28            const commentedAt = new Date(context.payload.comment.created_at);
29            const diffSeconds = Math.abs(commentedAt - closedAt) / 1000;
30            if (diffSeconds <= 30) {
31              core.notice(`Skipping — comment was likely part of "Close with comment" (${diffSeconds}s gap)`);
32              return false;
33            }
34            return true;
35
36      - if: steps.is-post-close-comment.outputs.result == 'true'
37        id: get-app-token
38        uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0
39        with:
40          app-id: ${{ secrets.ZED_COMMUNITY_BOT_APP_ID }}
41          private-key: ${{ secrets.ZED_COMMUNITY_BOT_PRIVATE_KEY }}
42          owner: zed-industries
43          repositories: zed
44          permission-members: read
45          permission-organization-projects: write
46
47      - if: steps.is-post-close-comment.outputs.result == 'true'
48        id: check-staff
49        uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
50        with:
51          github-token: ${{ steps.get-app-token.outputs.token }}
52          script: |
53            try {
54              const response = await github.rest.teams.getMembershipForUserInOrg({
55                org: 'zed-industries',
56                team_slug: 'staff',
57                username: context.payload.comment.user.login
58              });
59              return response.data.state === 'active';
60            } catch (error) {
61              // 404 means user is not a member
62              if (error.status === 404) {
63                return false;
64              }
65              throw error;
66            }
67
68      - if: steps.is-post-close-comment.outputs.result == 'true' && steps.check-staff.outputs.result == 'true'
69        env:
70          ISSUE_NUMBER: ${{ github.event.issue.number }}
71        run: |
72          echo "::notice::Skipping issue #$ISSUE_NUMBER - commenter is staff member"
73
74      # github-script outputs are JSON strings, so we compare against 'false' (string)
75      - if: steps.is-post-close-comment.outputs.result == 'true' && steps.check-staff.outputs.result == 'false'
76        env:
77          ISSUE_NUMBER: ${{ github.event.issue.number }}
78          COMMENT_USER_LOGIN: ${{ github.event.comment.user.login }}
79        run: |
80          echo "::notice::Adding issue #$ISSUE_NUMBER to project (comment by $COMMENT_USER_LOGIN)"
81
82      - if: steps.is-post-close-comment.outputs.result == 'true' && steps.check-staff.outputs.result == 'false'
83        uses: actions/add-to-project@244f685bbc3b7adfa8466e08b698b5577571133e # v1.0.2
84        with:
85          project-url: https://github.com/orgs/zed-industries/projects/73
86          github-token: ${{ steps.get-app-token.outputs.token }}
87
Served at tenant.openagents/omega Member data and write actions are omitted.