Update API files #1855
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
# This is a basic workflow to help you get started with Actions | |
name: Update API files | |
# Controls when the action will run. Triggers the workflow on push or pull request | |
# events but only for the master branch | |
on: | |
schedule: | |
- cron: '0 0 * * *' | |
push: | |
branches: | |
- main | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
build: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v4 | |
# Runs a single command using the runners shell | |
- name: Install dependencies | |
run: sudo apt-get install python3-setuptools pipx -y | |
- name: Install the updater | |
run: pipx install ./pyAPIUpdater/ | |
- name: Update the json files | |
run: | | |
for i in *.json; do | |
[ -f "$i" ] || break | |
apiupdater -filename $i -url https://map.freifunk-suedholstein.de/data/meshviewer.json | |
done | |
- name: Update repository | |
run: | | |
git remote add github "https://$GITHUB_ACTOR:[email protected]/$GITHUB_REPOSITORY.git" | |
git pull github ${GITHUB_REF} --ff-only | |
git add . | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git commit -m "Update node count" | |
git push github HEAD:${GITHUB_REF} |