Fetch Capitolnb Events #22
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 Capitolnb Events | |
on: | |
workflow_dispatch: | |
jobs: | |
artsdata-fetch-and-commit: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Action setup | |
uses: culturecreates/[email protected] | |
with: | |
mode: "fetch" | |
downloadFile: "capitolnb-events.jsonld" | |
page-url: "https://capitol.nb.ca/en/tickets-events?filter_45=2024-" | |
entity-identifier: "div.fc-item-block-standard-wrapper.odd a, div.fc-item-block-standard-wrapper.even a" | |
is-paginated: "10" | |
headless: "true" | |
token: "${{ secrets.GITHUB_TOKEN }}" | |
replace-location-name: | |
runs-on: ubuntu-latest | |
needs: artsdata-fetch-and-commit | |
outputs: | |
commit-hash: ${{ steps.get_commit_hash.outputs.commit-hash }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: pull changes | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Actions" | |
git pull | |
- name: Replace location | |
run: | | |
FILE="output/capitolnb-events.jsonld" | |
sed -i 's/"@value": "Capitol Theatre"/"@id": "http:\/\/kg.artsdata.ca\/resource\/K11-116"/g' "$FILE" | |
sed -i 's/"@value": "Empress Theatre"/"@id": "http:\/\/kg.artsdata.ca\/resource\/K11-116"/g' "$FILE" | |
- name: Commit and Push Changes | |
run: | | |
git pull | |
git add output/capitolnb-events.jsonld | |
git commit -m "Add data generated by the script" | |
git push | |
- name: Get commit hash | |
id: get_commit_hash | |
run: | | |
commit_hash=$(git rev-parse HEAD) | |
echo "commit-hash=$commit_hash" >> $GITHUB_OUTPUT | |
artsdata-push: | |
runs-on: ubuntu-latest | |
needs: replace-location-name | |
steps: | |
- name: Action setup | |
uses: culturecreates/[email protected] | |
with: | |
artifact: capitol-nb-ca | |
publisher: "${{ secrets.PUBLISHER_URI_GREGORY }}" | |
downloadUrl: https://raw.githubusercontent.com/culturecreates/artsdata-orion/${{ needs.replace-location-name.outputs.commit-hash }}/output/capitolnb-events.jsonld |