Skip to content

Commit

Permalink
test gha
Browse files Browse the repository at this point in the history
  • Loading branch information
joecorall committed Dec 4, 2024
1 parent 7c29a96 commit 92674c4
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 65 deletions.
64 changes: 0 additions & 64 deletions .github/workflows/run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,72 +45,8 @@ jobs:
token_format: 'access_token'
access_token_scopes: "https://www.googleapis.com/auth/spreadsheets"

- name: Get Job ID from GH API
id: get-job-id
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
jobs=$(gh api repos/${{ github.repository }}/actions/runs/${{ github.run_id}}/attempts/${{ github.run_attempt }}/jobs)
job_id=$(echo $jobs | jq -r '.jobs[] | select(.runner_name=="${{ runner.name }}") | .id')
echo "job_id=$job_id" >> $GITHUB_OUTPUT
- name: query google
run: ./scripts/download.sh
env:
URL: ${{ github.event.inputs.url }}
RANGE: ${{ github.event.inputs.range }}
ACCESS_TOKEN: ${{ steps.auth.outputs.access_token }}

- name: Notify Slack on Start
run: ./scripts/slack.sh
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
MESSAGE: |
${{ github.actor }} started workbench ingest for __TITLE__
Items being ingested: __LINE_COUNT__
Google Sheet: __URL__
Workbench execution log: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/job/${{ steps.get-job-id.outputs.job_id }}#step:10:1
URL: ${{ github.event.inputs.url }}

- name: transform google sheet
run: ./scripts/transform.sh
env:
URL: ${{ github.event.inputs.url }}
RANGE: ${{ github.event.inputs.range }}
ACCESS_TOKEN: ${{ steps.auth.outputs.access_token }}

- name: Checkout workbench
uses: actions/checkout@v4
with:
repository: lehigh-university-libraries/islandora_workbench
ref: simple-field-json
path: islandora_workbench

- name: execute
working-directory: islandora_workbench
run: ../scripts/run-workbench.sh
env:
ISLANDORA_WORKBENCH_PASSWORD: ${{ secrets.ISLANDORA_WORKBENCH_PASSWORD }}

- name: add node IDs to sheet
run: ./scripts/insert-nids.sh
env:
URL: ${{ github.event.inputs.url }}
ACCESS_TOKEN: ${{ steps.auth.outputs.access_token }}

- name: Notify Slack on Success
if: ${{ success() }}
run: ./scripts/slack.sh
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
MESSAGE: "✅ Workbench job succeeded!"

- name: Notify Slack on Failure
if: ${{ failure() }}
run: ./scripts/slack.sh
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
MESSAGE: "🚨 Workbench job failed!"
2 changes: 1 addition & 1 deletion scripts/insert-nids.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fi
# extract sheet ID from https://docs.google.com/spreadsheets/d/foo/edit?gid=0#gid=0
SHEET_ID=$(echo "$URL" | sed -n 's|.*/d/\(.*\)|\1|p')
API_URL="https://sheets.googleapis.com/v4/spreadsheets/$SHEET_ID/values/Sheet1!D2:append"
PAYLOAD=$(tail +4 islandora_workbench/input_data/rollback.csv | jq -nR '[inputs | {"values": [split("\n")]}]')
PAYLOAD=$(tail +4 /tmp/rollback.csv | jq -nR '[inputs | {"values": [split("\n")]}]')

curl -s -X POST \
--header "Authorization: Bearer $ACCESS_TOKEN" \
Expand Down

0 comments on commit 92674c4

Please sign in to comment.