Skip to content

Commit 8d5d11c

Browse files
committed
Add GitHub Issue Monitoring
1 parent 19dc3e8 commit 8d5d11c

File tree

2 files changed

+145
-0
lines changed

2 files changed

+145
-0
lines changed
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: Notify public Github activity on Slack
2+
3+
on:
4+
issues:
5+
types: [opened, reopened, labeled, closed]
6+
issue_comment:
7+
types: [created]
8+
pull_request_target:
9+
types: [opened, reopened]
10+
branches:
11+
- main
12+
13+
env:
14+
ISSUE_EMOJI: ":ladybug:"
15+
PR_EMOJI: ":male-technologist:"
16+
MSG_TITLE: "[Public GitHub]"
17+
18+
jobs:
19+
notify_new_issue:
20+
if: >-
21+
github.repository == 'quic/ai-hub-models'
22+
&& github.event_name == 'issues'
23+
&& (github.event.action == 'opened' || github.event.action == 'reopened')
24+
&& !contains(fromJSON('["MEMBER", "OWNER", "COLLABORATOR", "CONTRIBUTOR"]'), github.event.issue.author_association)
25+
name: Notify Slack - New Issue
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: slackapi/[email protected]
29+
with:
30+
channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
31+
slack-message: "${{ env.ISSUE_EMOJI }} ${{ env.MSG_TITLE }} New issue created: <${{ github.event.issue.html_url }}|${{ github.event.issue.title }}>"
32+
env:
33+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFIER_TOKEN }}
34+
35+
notify_new_issue_comment:
36+
if: >-
37+
github.repository == 'quic/ai-hub-models'
38+
&& github.event_name == 'issue_comment'
39+
&& !github.event.issue.pull_request
40+
&& github.event.action == 'created'
41+
&& !contains(fromJSON('["MEMBER", "OWNER", "COLLABORATOR", "CONTRIBUTOR"]'), github.event.comment.author_association)
42+
name: Notify Slack - New Issue Comment
43+
runs-on: ubuntu-latest
44+
steps:
45+
- uses: slackapi/[email protected]
46+
with:
47+
channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
48+
slack-message: "${{ env.ISSUE_EMOJI }} ${{ env.MSG_TITLE }} New issue comment: <${{ github.event.issue.html_url }}|${{ github.event.issue.title }}>"
49+
env:
50+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFIER_TOKEN }}
51+
52+
notify_stale_issues:
53+
if: >-
54+
github.repository == 'quic/ai-hub-models'
55+
&& github.event_name == 'issues'
56+
&& github.event.action == 'labeled'
57+
&& github.event.label.name == 'stale'
58+
&& github.actor == 'qaihm-bot'
59+
name: Notify Slack - Issue became Stale
60+
runs-on: ubuntu-latest
61+
steps:
62+
- uses: slackapi/[email protected]
63+
with:
64+
channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
65+
slack-message: "${{ env.ISSUE_EMOJI }} ${{ env.MSG_TITLE }} An issue became stale: <${{ github.event.issue.html_url }}|${{ github.event.issue.title }}>"
66+
env:
67+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFIER_TOKEN }}
68+
69+
notify_closed_stale_issues:
70+
if: >-
71+
github.repository == 'quic/ai-hub-models'
72+
&& github.event_name == 'issues'
73+
&& github.event.action == 'closed'
74+
&& github.actor == 'qaihm-bot'
75+
name: Notify Slack - Stale Issue Closed
76+
runs-on: ubuntu-latest
77+
steps:
78+
- uses: slackapi/[email protected]
79+
with:
80+
channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
81+
slack-message: "${{ env.ISSUE_EMOJI }} ${{ env.MSG_TITLE }} A stale issue was auto-closed: <${{ github.event.issue.html_url }}|${{ github.event.issue.title }}>"
82+
env:
83+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFIER_TOKEN }}
84+
85+
notify_new_pr:
86+
if: >-
87+
github.repository == 'quic/ai-hub-models'
88+
&& github.event_name == 'pull_request_target'
89+
&& (github.event.action == 'opened' || github.event.action == 'reopened')
90+
&& !contains(fromJSON('["MEMBER", "OWNER", "COLLABORATOR", "CONTRIBUTOR"]'), github.event.pull_request.author_association)
91+
name: Notify Slack - New PR Created
92+
runs-on: ubuntu-latest
93+
steps:
94+
- uses: slackapi/[email protected]
95+
with:
96+
channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
97+
slack-message: "${{ env.PR_EMOJI }} ${{ env.MSG_TITLE }} New PR: <${{ github.event.pull_request.html_url }}|${{ github.event.pull_request.title }}>"
98+
env:
99+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFIER_TOKEN }}
100+
101+
notify_new_pr_comment:
102+
if: >-
103+
github.repository == 'quic/ai-hub-models'
104+
&& github.event_name == 'issue_comment'
105+
&& github.event.issue.pull_request
106+
&& github.event.action == 'created'
107+
&& !contains(fromJSON('["MEMBER", "OWNER", "COLLABORATOR", "CONTRIBUTOR"]'), github.event.comment.author_association)
108+
name: Notify Slack - New PR Comment
109+
runs-on: ubuntu-latest
110+
steps:
111+
- uses: slackapi/[email protected]
112+
with:
113+
channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
114+
slack-message: "${{ env.PR_EMOJI }} ${{ env.MSG_TITLE }} New PR Comment: <${{ github.event.issue.pull_request.html_url }}|${{ github.event.issue.pull_request.title }}>"
115+
env:
116+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFIER_TOKEN }}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Notify, Mark, and Close Stale Issues and PRs
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * *' # Runs daily at midnight UTC
6+
workflow_dispatch:
7+
8+
jobs:
9+
stale:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
actions: write
13+
issues: write
14+
steps:
15+
- uses: actions/stale@v10 # Use the latest version of the stale action
16+
with:
17+
days-before-issue-stale: 30
18+
days-before-issue-close: 7
19+
labels-to-remove-when-unstale: 'stale'
20+
stale-issue-label: 'stale'
21+
stale-issue-message: >
22+
This issue has been automatically marked as stale because it has not had
23+
recent activity. It will be closed if no further activity occurs.
24+
close-issue-message: >
25+
Closing this issue due to inactivity. If you feel this issue is still relevant,
26+
please reopen it and provide additional information.
27+
exempt-issue-labels: 'Feature Request'
28+
enable-statistics: true
29+
repo-token: ${{ secrets.QAIHM_BOT_TOKEN }}

0 commit comments

Comments
 (0)