Skip to content

Fetch from source

Fetch from source #348

Workflow file for this run

name: Fetch from source
on:
schedule:
- cron: 0 0 * * 2,5
workflow_dispatch:
jobs:
Get-Source:
env:
FETCH_URL: 'https://youtube.fandom.com/api.php?action=query&format=json&origin=*&prop=revisions&titles=MediaWiki%3ACommon.css&formatversion=2&rvprop=content'
name: Fetch and commit source
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: set -euo pipefail
- run: echo '[INFO] Setting Git up...'
- run: git config --global user.name 'Actions'; git config --global user.email 'actions@github.com'
- run: echo "[INFO] $GITHUB_WORKSPACE"
- run: cd "$GITHUB_WORKSPACE"
- run: curl -fsSL '${{env.FETCH_URL}}' | jq -r '.query.pages[0].revisions[0].content' > Common.css
- run: git add Common.css
- run: git commit -m 'Fetch latest revision from URL' && git push -u origin main || echo '[INFO] Source is the same as repository. Skipping push...'
- run: echo '[EXIT] Job done!'; exit 0