social-post #277
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |