Backup sparql queries #10
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 Queries | |
on: | |
schedule: | |
- cron: '0 1 * * *' | |
workflow_dispatch: | |
jobs: | |
update_queries: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.x | |
- name: Install dependencies | |
run: | | |
pip install requests | |
- name: Run update script | |
run: python3 "${{ github.workspace }}/retrieve-queries.py" | |
env: | |
API_URL: https://api.linkeddata.cultureelerfgoed.nl/queries/ | |
OUTPUT_FOLDER: "${{ github.workspace }}/LDV" | |
- name: Check for changes | |
id: check_changes | |
run: | | |
if git diff --exit-code; then | |
echo "No changes to commit" | |
exit 0 | |
fi | |
exit 1 | |
- name: Commit and push changes | |
if: steps.check_changes.outcome == 'failure' | |
run: | | |
git config user.name "${{ github.actor }}" | |
git config user.email "${{ github.actor }}@users.noreply.github.com" | |
git add . | |
git commit -m "Automated update of sparql queries" | |
git push |