Skip to content

Commit

Permalink
Updated workflow to use new links for jsonld
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-aravind committed Jun 4, 2024
1 parent 55d5326 commit 6ebedd7
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 15 deletions.
31 changes: 23 additions & 8 deletions .github/workflows/scenesfrancophones-artists.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,36 @@ name: Fetch Scenesfrancophones Artists
on:
workflow_dispatch:
schedule:
- cron: '0 0 1 * *' #run every month first day
- 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: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Run Main Script
run: bundle exec ruby main.rb "https://scenesfrancophones.ca/artistes?page=" "https://scenesfrancophones.ca" "article.node.node--promoted.artiste.artiste--teaser.card" "output/artists.jsonld"

- name: curl-jsonld
run: curl https://scenesfrancophones.ca/donneesouvertes/artistes.json > output/artists.jsonld

- name: Check for file changes
id: check-changes
run: |
if [ -f "output/artists.jsonld" ]; then
if git diff --exit-code output/artists.jsonld; then
echo "HAS_CHANGES=false" >> $GITHUB_OUTPUT
else
echo "HAS_CHANGES=true" >> $GITHUB_OUTPUT
fi
else
echo "HAS_CHANGES=true" >> $GITHUB_OUTPUT
fi
shell: bash

- 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"
Expand All @@ -29,11 +44,11 @@ jobs:
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"

17 changes: 10 additions & 7 deletions .github/workflows/scenesfrancophones-events.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,20 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Run Main Script
run: bundle exec ruby main.rb https://scenesfrancophones.ca/spectacles?page= https://scenesfrancophones.ca div.title output/events.jsonld

- name: curl-jsonld
run: curl https://scenesfrancophones.ca/donneesouvertes/evenements.json > output/events.jsonld

- name: Check for file changes
id: check-changes
run: |
if [ -n "$(git diff --cached outputs/events.jsonld)" ]; then
if [ -f "output/events.jsonld" ]; then
if git diff --exit-code output/events.jsonld; then
echo "HAS_CHANGES=false" >> $GITHUB_OUTPUT
else
echo "HAS_CHANGES=true" >> $GITHUB_OUTPUT
fi
else
echo "HAS_CHANGES=true" >> $GITHUB_OUTPUT
fi
shell: bash
Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/scenesfrancophones-places.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Fetch Scenesfrancophones Places

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/lieux.json > output/places.jsonld

- name: Check for file changes
id: check-changes
run: |
if [ -f "output/places.jsonld" ]; then
if git diff --exit-code output/places.jsonld; then
echo "HAS_CHANGES=false" >> $GITHUB_OUTPUT
else
echo "HAS_CHANGES=true" >> $GITHUB_OUTPUT
fi
else
echo "HAS_CHANGES=true" >> $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/places.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-places
publisher: "${{ secrets.PUBLISHER_URI_GREGORY }}"
downloadUrl: "https://raw.githubusercontent.com/culturecreates/artsdata-planet-scenesfrancophones/main/output/places.jsonld"

0 comments on commit 6ebedd7

Please sign in to comment.