Fetch webmentions #38240
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
# adapted from work by Rowan Manning | |
# https://github.com/rowanmanning/rowanmanning.com | |
# https://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB | |
name: Fetch webmentions | |
# Run every 30 minutes | |
on: | |
schedule: | |
- cron: "*/30 * * * *" | |
workflow_dispatch: {} | |
# Jobs | |
jobs: | |
webmentions: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
# Set up Node.js and install dependencies | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16.x | |
- uses: actions/cache@v3 | |
env: | |
cache-version: v1 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-${{ env.cache-version }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-${{ env.cache-version }}- | |
${{ runner.os }}- | |
- run: npm install | |
# Fetch and process webmentions | |
- name: Fetch webmentions | |
env: | |
WEBMENTIONS_TOKEN: ${{ secrets.WEBMENTIONS_TOKEN }} | |
run: make fetch-webmentions | |
# Commit new webmentions to the repo | |
- name: Commit to the repo | |
env: | |
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }} | |
run: | | |
git config --global user.name "Julian Elve" | |
git config --global user.email "julian@elve.london" | |
git remote set-url origin "https://${GITHUB_ACTOR}:${DEPLOY_KEY}@github.com/${GITHUB_REPOSITORY}.git" | |
git checkout master | |
git add . | |
git diff --quiet && git diff --staged --quiet || (git commit -m "Fetch webmentions"; git push origin master) |