Update Data from DOAG API #311
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
--- | |
name: Update Data from DOAG API | |
on: | |
workflow_dispatch: {} | |
schedule: | |
# every hour | |
- cron: "0 */1 * * *" | |
jobs: | |
update_data: | |
name: Update Data from DOAG API | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: gh-pages | |
token: ${{ secrets.GH_PUSH_TOKEN }} | |
- uses: actions/cache@v3 | |
with: | |
path: /root/.jbang | |
key: ${{ runner.os }}-jbang-${{ hashFiles('*.java') }} | |
restore-keys: | | |
${{ runner.os }}-jbang- | |
- name: Fetch data | |
run: | | |
curl -s -f https://shop.doag.org/api/event/action.getMyLocationEvent/eventId.105 -o event.json | |
curl -s -f https://shop.doag.org/api/event/action.getCPEventAgenda/eventId.105 -o agenda.json | |
- name: Create iCalendar | |
uses: jbangdev/jbang-action@v0.104.0 | |
with: | |
script: ".github/workflows/scripts/CreateIcal.java" | |
- name: Push updates | |
run: | | |
git config user.name "$GITHUB_ACTOR" | |
git config user.email "$GITHUB_ACTOR@users.noreply.github.com" | |
git add event.json | |
git add cloudland23.ics | |
set +e | |
git commit -m "Update event.json and cloudland23.ics" | |
if [ $? -eq 0 ]; then | |
set -e | |
git push origin gh-pages | |
else | |
echo "Files up to date" | |
fi | |