-
Notifications
You must be signed in to change notification settings - Fork 51
54 lines (46 loc) · 1.84 KB
/
update_genuary.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
name: Update Genuary
on:
workflow_dispatch:
schedule:
# We want '0 9 * 1 *' in Pacific Time, but GitHub Actions doesn't support timezones.
# So we use '0 17 * 1 *' in UTC, which is 9 AM in Pacific Time.
- cron: '0 17 * * *'
jobs:
update-genuary:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Get pins
run: | # TODO: Update CEL expression to filter by the current year.
go run github.com/ethanthatonekid/pins@latest \
get -o /tmp/pins $GUILD_ID "channel_parent_id == $CHANNEL_ID"
env:
GUILD_ID: ${{ secrets.GUILD_ID }}
CHANNEL_ID: ${{ secrets.GENUARY_CHANNEL_ID }}
DISCORD_TOKEN: ${{ secrets.GENUARY_DISCORD_TOKEN }}
- name: Transform Genuary data
id: transform-genuary
run: |
year=$(date +%Y)
echo "year=$year" >> $GITHUB_OUTPUT
# TODO: Remove $year as an argument once the CEL expression is updated.
node scripts/transform-genuary/index.js /tmp/pins/*.json $year \
> "src/routes/(site)/genuary/$year/data.json"
if git diff --exit-code --quiet; then
echo "updated=0" >> $GITHUB_OUTPUT
else
echo "updated=1" >> $GITHUB_OUTPUT
fi
- name: Create pull request
if: steps.transform-genuary.outputs.updated == 1
uses: peter-evans/create-pull-request@v4
with:
title: |-
Update Genuary ${{ steps.transform-genuary.outputs.year }} :calendar: :sparkles: :art:
body: |-
This pull request was automatically generated by GitHub Actions.
:sparkles: :sparkles: :sparkles:
commit-message: |-
Update Genuary ${{ steps.transform-genuary.outputs.year }} :calendar: :sparkles: :art:
labels: genuary
branch: genuary