track_duplicate_bot_effectiveness.yml

 1name: Track duplicate bot effectiveness
 2
 3on:
 4  issues:
 5    types: [closed]
 6  schedule:
 7    - cron: "0 8 */2 * *" # every 2 days at 8 AM UTC
 8  workflow_dispatch:
 9
10permissions:
11  contents: read
12
13jobs:
14  classify-closed-issue:
15    if: >
16      github.event_name == 'issues' &&
17      github.repository == 'zed-industries/zed' &&
18      github.event.issue.pull_request == null &&
19      github.event.issue.type != null &&
20      (github.event.issue.type.name == 'Bug' || github.event.issue.type.name == 'Crash')
21    runs-on: ubuntu-latest
22    timeout-minutes: 5
23    steps:
24      - name: Checkout repository
25        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
26        with:
27          sparse-checkout: script/github-track-duplicate-bot-effectiveness.py
28          sparse-checkout-cone-mode: false
29
30      - name: Get github app token
31        id: get-app-token
32        uses: actions/create-github-app-token@bef1eaf1c0ac2b148ee2a0a74c65fbe6db0631f1 # v1.11.7
33        with:
34          app-id: ${{ secrets.ZED_COMMUNITY_BOT_APP_ID }}
35          private-key: ${{ secrets.ZED_COMMUNITY_BOT_PRIVATE_KEY }}
36          owner: zed-industries
37
38      - name: Set up Python
39        uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
40        with:
41          python-version: "3.12"
42
43      - name: Install dependencies
44        run: pip install requests
45
46      - name: Classify closed issue
47        env:
48          GITHUB_TOKEN: ${{ steps.get-app-token.outputs.token }}
49          ISSUE_NUMBER: ${{ github.event.issue.number }}
50          CLOSER_LOGIN: ${{ github.event.sender.login }}
51          STATE_REASON: ${{ github.event.issue.state_reason }}
52        run: |
53          python script/github-track-duplicate-bot-effectiveness.py \
54            classify-closed "$ISSUE_NUMBER" "$CLOSER_LOGIN" "$STATE_REASON"
55
56  classify-open:
57    if: >
58      github.repository == 'zed-industries/zed' &&
59      (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
60    runs-on: ubuntu-latest
61    timeout-minutes: 10
62    steps:
63      - name: Checkout repository
64        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
65        with:
66          sparse-checkout: script/github-track-duplicate-bot-effectiveness.py
67          sparse-checkout-cone-mode: false
68
69      - name: Get github app token
70        id: get-app-token
71        uses: actions/create-github-app-token@bef1eaf1c0ac2b148ee2a0a74c65fbe6db0631f1 # v1.11.7
72        with:
73          app-id: ${{ secrets.ZED_COMMUNITY_BOT_APP_ID }}
74          private-key: ${{ secrets.ZED_COMMUNITY_BOT_PRIVATE_KEY }}
75          owner: zed-industries
76
77      - name: Set up Python
78        uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
79        with:
80          python-version: "3.12"
81
82      - name: Install dependencies
83        run: pip install requests
84
85      - name: Classify open issues
86        env:
87          GITHUB_TOKEN: ${{ steps.get-app-token.outputs.token }}
88        run: |
89          python script/github-track-duplicate-bot-effectiveness.py classify-open