Skip to content

Commit d453ca6

Browse files
authored
πŸ‘·β€β™‚οΈ Added a new GH action to watch for glide activity stream (#239)
1 parent 66c5f5b commit d453ca6

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Pull Request Activity Notifications
2+
3+
on:
4+
pull_request:
5+
types: [opened, closed, reopened]
6+
7+
jobs:
8+
activity_notifications:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Gather PR context
12+
id: context
13+
uses: actions/github-script@v4
14+
with:
15+
github-token: ${{ secrets.GITHUB_TOKEN }}
16+
script: |
17+
const pr = context.payload.pull_request;
18+
const author = pr.user.login;
19+
const project = context.payload.repository.full_name;
20+
const action = context.payload.action;
21+
const wasMerged = pr.merged;
22+
23+
console.log(`Action: ${action}`);
24+
console.log(`PR Author: ${author}`);
25+
console.log(`Project: ${project}`);
26+
console.log(`Was Merged?: ${wasMerged}`);
27+
28+
core.setOutput('author', author);
29+
core.setOutput('project', project);
30+
core.setOutput('action', action);
31+
core.setOutput('wasMerged', wasMerged);
32+
33+
- name: Send Discord Notification for opened PR
34+
if: ${{ github.event_name == 'pull_request' && github.event.action == 'opened' }}
35+
uses: Ilshidur/action-discord@master
36+
env:
37+
DISCORD_WEBHOOK: ${{ secrets.ACTIVITY_DISCORD_WEBHOOK_URL }}
38+
with:
39+
args: "✨️[New Pull Request]\nProject: ${{ steps.context.outputs.project }}\nAuthor: ${{ steps.context.outputs.author }}\nLink: ${{ github.event.pull_request.html_url }}"
40+
41+
- name: Send Discord Notification for closed PR
42+
if: ${{ github.event_name == 'pull_request' && github.event.action == 'closed' && steps.context.outputs.wasMerged == 'false' }}
43+
uses: Ilshidur/action-discord@master
44+
env:
45+
DISCORD_WEBHOOK: ${{ secrets.ACTIVITY_DISCORD_WEBHOOK_URL }}
46+
with:
47+
args: "🚫[Pull Request Closed]\nProject: ${{ steps.context.outputs.project }}\nAuthor: ${{ steps.context.outputs.author }}\nLink: ${{ github.event.pull_request.html_url }}"
48+
49+
- name: Send Discord Notification for merged PR
50+
if: ${{ github.event_name == 'pull_request' && github.event.action == 'closed' && steps.context.outputs.wasMerged == 'true' }}
51+
uses: Ilshidur/action-discord@master
52+
env:
53+
DISCORD_WEBHOOK: ${{ secrets.ACTIVITY_DISCORD_WEBHOOK_URL }}
54+
with:
55+
args: "βœ…[Pull Request Merged]\nProject: ${{ steps.context.outputs.project }}\nAuthor: ${{ steps.context.outputs.author }}\nLink: ${{ github.event.pull_request.html_url }}"
56+
57+
- name: Send Discord Notification for reopened PR
58+
if: ${{ github.event_name == 'pull_request' && github.event.action == 'reopened' }}
59+
uses: Ilshidur/action-discord@master
60+
env:
61+
DISCORD_WEBHOOK: ${{ secrets.ACTIVITY_DISCORD_WEBHOOK_URL }}
62+
with:
63+
args: "πŸ› οΈ[Pull Request Reopened]\nProject: ${{ steps.context.outputs.project }}\nAuthor: ${{ steps.context.outputs.author }}\nLink: ${{ github.event.pull_request.html_url }}"

0 commit comments

Comments
Β (0)