Skip to content

Fetch stuff and commit changes #112

Fetch stuff and commit changes

Fetch stuff and commit changes #112

Workflow file for this run

name: Fetch adfirst.media JS
on:
push:
workflow_dispatch:
schedule:
- cron: '30 */6 * * *'
permissions:
contents: write
jobs:
fetch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- run: npm install
- run: sudo apt-get install -y libxml2-utils
- name: Fetch
run: |
curl -s "https://cdn.adfirst.media/hb/bustimes.js" | npx js-beautify > bustimes.js
curl -s "https://www.travelinedata.org.uk/noc/api/1.0/nocrecords.xml" | iconv -f utf-8 -t utf-8 -c | xmllint --format - > nocrecords.xml
- name: Commit and push
run: |-
git config user.name "Automated"
git config user.email "[email protected]"
git diff
git add bustimes.js
if [ "$(git diff --shortstat nocrecords.xml)" != " 1 file changed, 1 insertion(+), 1 deletion(-)" ]; then
git add nocrecords.xml
fi
git commit -m "change!" || exit 0
git pull --rebase
git push