generated from compsoc-edinburgh/deployment
-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (68 loc) · 2.95 KB
/
update-discord-messages.yaml
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: Update Discord Messages
on:
push:
branches:
- main
paths:
- 'messages/**'
jobs:
update-discord:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
# GitHub Actions doesn't have a native way to execute certain steps within
# a job based on what files were changed. For this, we use an external
# action, which sets the "steps.changes.outputs.<filter-name>" to true or
# false depending on whether it changed.
#
# It's important to execute only message updates if the file changed, since
# an update will change the Discord embed's "Last Updated" datetime, even
# if there were no content changes. We try to maintain that datetime as
# accurate as possible, so we want to trigger an update only if there was
# an actual change.
- uses: dorny/paths-filter@v2
id: changes
with:
list-files: none
filters: |
readme:
- 'messages/readme.xml'
pronouns:
- 'messages/pronouns.xml'
year:
- 'messages/year.xml'
protectedgroups:
- 'messages/protectedgroups.xml'
- name: Update main README message
uses: compsoc-edinburgh/discord-post-updater@master
if: steps.changes.outputs.readme == 'true'
with:
discord_token: ${{ secrets.discord_bot_token }}
post_xml: messages/readme.xml
discord_channel: '716143154562203668' # N.B. The quote marks here are required
discord_message: '1008385178718191719' # Optional, use quotes if specifying an ID
- name: Update Pronouns
uses: compsoc-edinburgh/discord-post-updater@master
if: steps.changes.outputs.pronouns == 'true'
with:
discord_token: ${{ secrets.discord_bot_token }}
post_xml: messages/pronouns.xml
discord_channel: '716143154562203668' # N.B. The quote marks here are required
discord_message: '1008385179812892703' # Optional, use quotes if specifying an ID
- name: Update Academic Year
uses: compsoc-edinburgh/discord-post-updater@master
if: steps.changes.outputs.year == 'true'
with:
discord_token: ${{ secrets.discord_bot_token }}
post_xml: messages/year.xml
discord_channel: '716143154562203668' # N.B. The quote marks here are required
discord_message: '1008385180945363014' # Optional, use quotes if specifying an ID
- name: Update Protected Groups
uses: compsoc-edinburgh/discord-post-updater@master
if: steps.changes.outputs.protectedgroups == 'true'
with:
discord_token: ${{ secrets.discord_bot_token }}
post_xml: messages/protectedgroups.xml
discord_channel: '716143154562203668' # N.B. The quote marks here are required
discord_message: '1008385181977149610' # Optional, use quotes if specifying an ID