Fetch Scenesfrancophones Artists #38
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: Fetch Scenesfrancophones Artists | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 5 * * 1" # Run at 1:00 AM ET every Monday | |
jobs: | |
fetch-and-commit-data: | |
runs-on: ubuntu-latest | |
outputs: | |
changes: ${{ steps.check-changes.outputs.HAS_CHANGES }} | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: curl-jsonld | |
run: curl https://scenesfrancophones.ca/donneesouvertes/artistes.json > output/artists.jsonld | |
- name: Check for file changes | |
id: check-changes | |
run: | | |
if git status --porcelain | grep -q 'output/artists.jsonld'; then | |
echo "HAS_CHANGES=true" >> $GITHUB_OUTPUT | |
else | |
echo "HAS_CHANGES=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Commit and Push Changes | |
if: steps.check-changes.outputs.HAS_CHANGES == 'true' | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Actions" | |
git pull | |
git add "output/artists.jsonld" | |
git commit -m "Add data generated by the script" | |
git push | |
artsdata-push: | |
runs-on: ubuntu-latest | |
needs: fetch-and-commit-data | |
if: needs.fetch-and-commit-data.outputs.changes == 'true' | |
steps: | |
- name: Action setup | |
uses: culturecreates/[email protected] | |
with: | |
artifact: scenesfrancophones-artists | |
publisher: "${{ secrets.PUBLISHER_URI_GREGORY }}" | |
downloadUrl: "https://raw.githubusercontent.com/culturecreates/artsdata-planet-scenesfrancophones/main/output/artists.jsonld" |