-
Notifications
You must be signed in to change notification settings - Fork 2
86 lines (77 loc) · 2.84 KB
/
social-post.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
76
77
78
79
80
81
82
83
84
85
86
name: social-post
on:
schedule:
# Every day at 00:42 UTC
- cron: '45 0 * * *'
workflow_dispatch:
inputs:
date:
description: 'Date of changes (YYYY-MM-DD)'
required: false
jobs:
socialpost:
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure target date
run: |
if [ "${{ github.event.inputs.date }}" != "" ]; then
TARGET_DATE=${{ github.event.inputs.date }}
else
TARGET_DATE=$(date -u +%Y-%m-%d)
fi
echo "Checking for changes on ${TARGET_DATE}"
echo "TARGET_DATE=${TARGET_DATE}" >> "$GITHUB_ENV"
- name: Download social-post utility
run: |
curl \
--silent \
--location \
https://github.com/fileformat/social-post/releases/latest/download/social-post_Linux_x86_64.tar.gz \
> social-post.tar.gz
tar -xzf social-post.tar.gz social-post
# LATER: Generate PNGs
# - name: Install dependencies
# run: sudo apt-get install -y curl jq librsvg2-bin
# - name: Generate PNGs
# run: true
- name: TLD changes
env:
MASTODON_SERVER: ${{ secrets.MASTODON_TLD_SERVER }}
MASTODON_USER_TOKEN: ${{ secrets.MASTODON_TLD_USER_TOKEN }}
run: |
if [ ! -f "data/icann/deltas/${TARGET_DATE}.txt" ]; then
echo "No TLD changes found for ${TARGET_DATE}"
else
NEWLINE=$'\n'
./social-post mastodon \
"ICANN TLD changes for ${TARGET_DATE}:${NEWLINE}$(bin/max10lines.sh data/icann/deltas/${TARGET_DATE}.txt)${NEWLINE}${NEWLINE}https://resolve.rs/tlds/changelog/index.html"
fi
- name: PSL changes
env:
MASTODON_SERVER: ${{ secrets.MASTODON_PSL_SERVER }}
MASTODON_USER_TOKEN: ${{ secrets.MASTODON_PSL_USER_TOKEN }}
run: |
if [ ! -f "data/publicsuffix/deltas/${TARGET_DATE}.txt" ]; then
echo "No PSL changes found for ${TARGET_DATE}"
else
NEWLINE=$'\n'
./social-post mastodon \
"Mozilla public suffix changes for ${TARGET_DATE}:${NEWLINE}$(bin/max10lines.sh data/publicsuffix/deltas/${TARGET_DATE}.txt)${NEWLINE}${NEWLINE}https://resolve.rs/psl/changelog/index.html"
fi
- name: Notify NodePing
env:
NODEPING_CHECKTOKEN: ${{ secrets.NODEPING_SOCIALPOST_CHECKTOKEN }}
NODEPING_ID: ${{ secrets.NODEPING_SOCIALPOST_ID }}
if: ${{ github.event_name == 'schedule' }}
run: |
if [ "${NODEPING_CHECKTOKEN}" != "" ] && [ "${NODEPING_ID}" != "" ]; then
curl \
--silent \
--request POST \
"https://push.nodeping.com/v1?id=${NODEPING_ID}&checktoken=${NODEPING_CHECKTOKEN}"
else
echo "WARNING: nodeping not configured for update-data"
fi