Skip to content

Archive New Conference URLs #4

Archive New Conference URLs

Archive New Conference URLs #4

name: Check New Conference URLs
on:
schedule:
- cron: '0 0 * * *' # Runs at 00:00 UTC every day
workflow_dispatch:
# Allows manual triggering
jobs:
check-new-urls:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history for finding last run
- name: Find last successful run commit
id: last-run
run: |
last_sha=$(gh run list --workflow="Check New Conference URLs" --json conclusion,headSha --jq '.[] | select(.conclusion=="success") | .headSha' | head -n1)
if [ -n "$last_sha" ]; then
echo "sha=$last_sha" >> $GITHUB_OUTPUT
else
# If no previous run, use the first commit
echo "sha=$(git rev-list --max-parents=0 HEAD)" >> $GITHUB_OUTPUT
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Extract new URLs from diff and archive
id: url-check
run: |
# Extract URLs and set up multiline output
URLS=$(git diff ${{ steps.last-run.outputs.sha }} -- _data/conferences.yml | \
grep -E '^\+.*https?://[^ ]+' | \
sed -E 's/^\+[[:space:]]*[^:]*:[[:space:]]*(https?:\/\/[^ ]+).*/\1/')
if [ -n "$URLS" ]; then
echo "has_new_urls=true" >> $GITHUB_OUTPUT
{
echo "urls<<EOF"
echo "$URLS"
echo "EOF"
} >> $GITHUB_OUTPUT
echo "Found new URLs:"
echo "$URLS"
else
echo "has_new_urls=false" >> $GITHUB_OUTPUT
echo "No new URLs found"
fi
- name: Archive new URLs in Wayback Machine
if: steps.url-check.outputs.has_new_urls == 'true'
uses: JamieMagee/[email protected]
with:
url: |-
${{ steps.url-check.outputs.urls }}