-
Notifications
You must be signed in to change notification settings - Fork 1
55 lines (45 loc) · 1.68 KB
/
announcements.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: Announcement
run-name: Send Announcement
on:
schedule:
# the time here is kinda random to dodge high load time on GH that may block cron jobs
# if cron jobs are delayed for too long, they might be dropped -> bad
- cron: '43 4 1 1 *'
- cron: '43 4 1 2 *'
- cron: '*/5 * * * *'
jobs:
announce:
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repo'
uses: actions/checkout@v4
- name: 'Setup Deno'
uses: denoland/setup-deno@v1
# set to public at the start of the year
- name: 'Show Repo'
if: github.event.schedule == '43 2 1 1 *'
run: gh repo edit ${{ github.repository }} --visibility public
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
# set to private at the beginning of February
- name: 'Hide Repo'
if: github.event.schedule == '43 2 1 2 *'
run: gh repo edit ${{ github.repository }} --visibility private
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
- name: 'Send Announcement'
run: |
if [ "${{github.event.schedule}}" == '43 2 1 1 *' ]
then
message='The Census Renewal Website is now open! It will be closed on 1 February.'
elif [ "${{github.event.schedule}}" == '43 2 1 2 *' ]
then
message='The Census Renewal Website has closed! It will reopen on 1 January.'
elif [ "${{github.event.schedule}}" == '*/5 * * * *' ]
then
message='uh, hi. This could get spammy'
fi
if [ -n "$message" ]
then
deno run --allow-net ./.github/workflows/sendAnnouncement.ts ${{secrets.DISCORD_ANNOUNCEMENT_WEBHOOK}} "$message"
fi