Skip to content

Commit 09ece6a

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

File tree

2 files changed

+139
-0
lines changed

2 files changed

+139
-0
lines changed
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
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.event_name == 'issues'
22+
&& (github.event.action == 'opened' || github.event.action == 'reopened')
23+
&& !contains(fromJSON('["MEMBER", "OWNER", "COLLABORATOR", "CONTRIBUTOR"]'), github.event.issue.author_association)
24+
name: Notify Slack - New Issue
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: slackapi/[email protected]
28+
with:
29+
channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
30+
slack-message: "${{ env.ISSUE_EMOJI }} ${{ env.MSG_TITLE }} New issue created: <${{ github.event.issue.html_url }}|${{ github.event.issue.title }}>"
31+
env:
32+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFIER_TOKEN }}
33+
34+
notify_new_issue_comment:
35+
if: >-
36+
github.event_name == 'issue_comment'
37+
&& !github.event.issue.pull_request
38+
&& github.event.action == 'created'
39+
&& !contains(fromJSON('["MEMBER", "OWNER", "COLLABORATOR", "CONTRIBUTOR"]'), github.event.comment.author_association)
40+
name: Notify Slack - New Issue Comment
41+
runs-on: ubuntu-latest
42+
steps:
43+
- uses: slackapi/[email protected]
44+
with:
45+
channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
46+
slack-message: "${{ env.ISSUE_EMOJI }} ${{ env.MSG_TITLE }} New issue comment: <${{ github.event.issue.html_url }}|${{ github.event.issue.title }}>"
47+
env:
48+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFIER_TOKEN }}
49+
50+
notify_stale_issues:
51+
if: >-
52+
github.event_name == 'issues'
53+
&& github.event.action == 'labeled'
54+
&& github.event.label.name == 'stale'
55+
&& github.actor == 'qaihm-bot'
56+
name: Notify Slack - Issue became Stale
57+
runs-on: ubuntu-latest
58+
steps:
59+
- uses: slackapi/[email protected]
60+
with:
61+
channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
62+
slack-message: "${{ env.ISSUE_EMOJI }} ${{ env.MSG_TITLE }} An issue became stale: <${{ github.event.issue.html_url }}|${{ github.event.issue.title }}>"
63+
env:
64+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFIER_TOKEN }}
65+
66+
notify_closed_stale_issues:
67+
if: >-
68+
github.event_name == 'issues'
69+
&& github.event.action == 'closed'
70+
&& github.actor == 'qaihm-bot'
71+
name: Notify Slack - Stale Issue Closed
72+
runs-on: ubuntu-latest
73+
steps:
74+
- uses: slackapi/[email protected]
75+
with:
76+
channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
77+
slack-message: "${{ env.ISSUE_EMOJI }} ${{ env.MSG_TITLE }} A stale issue was auto-closed: <${{ github.event.issue.html_url }}|${{ github.event.issue.title }}>"
78+
env:
79+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFIER_TOKEN }}
80+
81+
notify_new_pr:
82+
if: >-
83+
github.event_name == 'pull_request_target'
84+
&& (github.event.action == 'opened' || github.event.action == 'reopened')
85+
&& !contains(fromJSON('["MEMBER", "OWNER", "COLLABORATOR", "CONTRIBUTOR"]'), github.event.pull_request.author_association)
86+
name: Notify Slack - New PR Created
87+
runs-on: ubuntu-latest
88+
steps:
89+
- uses: slackapi/[email protected]
90+
with:
91+
channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
92+
slack-message: "${{ env.PR_EMOJI }} ${{ env.MSG_TITLE }} New PR: <${{ github.event.pull_request.html_url }}|${{ github.event.pull_request.title }}>"
93+
env:
94+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFIER_TOKEN }}
95+
96+
notify_new_pr_comment:
97+
if: >-
98+
github.event_name == 'issue_comment'
99+
&& github.event.issue.pull_request
100+
&& github.event.action == 'created'
101+
&& !contains(fromJSON('["MEMBER", "OWNER", "COLLABORATOR", "CONTRIBUTOR"]'), github.event.comment.author_association)
102+
name: Notify Slack - New PR Comment
103+
runs-on: ubuntu-latest
104+
steps:
105+
- uses: slackapi/[email protected]
106+
with:
107+
channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
108+
slack-message: "${{ env.PR_EMOJI }} ${{ env.MSG_TITLE }} New PR Comment: <${{ github.event.issue.pull_request.html_url }}|${{ github.event.issue.pull_request.title }}>"
109+
env:
110+
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)