generated from OneGraph/oneblog
-
Notifications
You must be signed in to change notification settings - Fork 11
55 lines (49 loc) · 1.62 KB
/
discord-notification.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Discord Notifications
on:
workflow_dispatch:
schedule:
- cron: "7 13 * * 2"
jobs:
check-for-live-content:
runs-on: ubuntu-latest
steps:
- name: Check out the Project Board
uses: actions/github-script@v3
id: set-result
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const fs = require('fs')
const result = await github.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
labels: 'live',
});
const issue = result.data[0]
fs.writeFileSync('result.json', JSON.stringify(issue));
- name: Upload issue artifact
uses: actions/upload-artifact@v2
with:
name: issue-data
path: result.json
send-discord-notifcation:
needs: ['check-for-live-content']
runs-on: ubuntu-latest
steps:
- name: Download issue artifact
uses: actions/download-artifact@v2
with:
name: issue-data
- name: Grab the issue title
id: data
shell: bash
run: |
ISSUE_TITLE="$(jq '.title' result.json)"
echo $ISSUE_TITLE
echo ::set-output name=title::${ISSUE_TITLE}
- name: Discord notification
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/action-discord@master
with:
args: '@NotificationSquad, bdougie is going live today to ${{ steps.data.outputs.title }} at 1pm PT. Be sure to #share-your-content so you get a shout out live!'