Skip to content

Commit ae856a1

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

File tree

2 files changed

+147
-0
lines changed

2 files changed

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

0 commit comments

Comments
 (0)