Skip to content

Commit

Permalink
Updates KIAC crawl to use ferch and push workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-aravind committed Sep 9, 2024
1 parent a9f998c commit a6e261b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 57 deletions.
54 changes: 10 additions & 44 deletions .github/workflows/fetch-and-push-to-artsdata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ name: Reusable workflow to fetch JSON-LD data.

on:
workflow_call:
outputs:
commit-hash:
value: ${{jobs.fetch-and-commit-data.outputs.commit-hash}}
inputs:
page_url:
required: true
Expand All @@ -28,55 +25,24 @@ on:
PUBLISHER_URI_GREGORY:
required: true



jobs:
fetch-and-commit-data:
runs-on: ubuntu-latest
outputs:
commit-hash: ${{ steps.get_commit_hash.outputs.commit-hash }}
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
repository: culturecreates/artsdata-orion
ref: main
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Run Main Script
run: |
bundle exec ruby src/main.rb \
"${{ inputs.page_url }}" \
"${{ inputs.entity_identifier }}" \
output/${{ inputs.file_name }} \
${{ inputs.is_paginated}} \
${{ inputs.headless}} \
- name: Commit and Push Changes
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
git pull
git add "output/${{ inputs.file_name }}"
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
call-workflow-to-fetch-data:
uses: ./.github/workflows/fetch-data.yml
with:
page_url: ${{inputs.page_url}}
entity_identifier: ${{inputs.entity_identifier}}
file_name: ${{inputs.file_name}}
is_paginated: ${{inputs.is_paginated}}
headless: ${{inputs.headless}}

artsdata-push:
runs-on: ubuntu-latest
needs: fetch-and-commit-data
needs: call-workflow-to-fetch-data
steps:
- name: Action setup
uses: culturecreates/[email protected]
with:
artifact: ${{ inputs.artifact }}
publisher: "${{ secrets.PUBLISHER_URI_GREGORY }}"
downloadUrl: https://raw.githubusercontent.com/culturecreates/artsdata-orion/${{ needs.fetch-and-commit-data.outputs.commit-hash }}/output/${{ inputs.file_name }}
downloadUrl: https://raw.githubusercontent.com/culturecreates/artsdata-orion/${{ needs.call-workflow-to-fetch-data.outputs.commit-hash }}/output/${{ inputs.file_name }}

18 changes: 5 additions & 13 deletions .github/workflows/kiac-events.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,14 @@ on:
- cron: '0 0 1 * *'

jobs:
call-workflow-to-fetch-data:
uses: ./.github/workflows/fetch-data.yml
call-workflow-to-fetch-and-push-data:
uses: ./.github/workflows/fetch-and-push-to-artsdata.yml
with:
page_url: "https://kiac.ca/calendar-of-events/"
entity_identifier: "div.tribe-events-pro-photo__event-featured-image-wrapper a"
file_name: "kiac-events.jsonld"
is_paginated: "false"
headless: "false"

artsdata-push:
runs-on: ubuntu-latest
needs: call-workflow-to-fetch-data
steps:
- name: Action setup
uses: culturecreates/[email protected]
with:
artifact: kiac-ca
publisher: "${{ secrets.PUBLISHER_URI_GREGORY }}"
downloadUrl: https://raw.githubusercontent.com/culturecreates/artsdata-orion/${{ needs.call-workflow-to-fetch-data.outputs.commit-hash }}/output/kiac-events.jsonld
artifact: "kiac-ca"
secrets:
PUBLISHER_URI_GREGORY: ${{ secrets.PUBLISHER_URI_GREGORY }}

0 comments on commit a6e261b

Please sign in to comment.