From 92674c45688f47514d462678eac41d16512f4ead Mon Sep 17 00:00:00 2001 From: Joe Corall Date: Wed, 4 Dec 2024 13:57:22 -0500 Subject: [PATCH] test gha --- .github/workflows/run.yml | 64 --------------------------------------- scripts/insert-nids.sh | 2 +- 2 files changed, 1 insertion(+), 65 deletions(-) diff --git a/.github/workflows/run.yml b/.github/workflows/run.yml index a371b4c..b7cfb8c 100644 --- a/.github/workflows/run.yml +++ b/.github/workflows/run.yml @@ -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!" diff --git a/scripts/insert-nids.sh b/scripts/insert-nids.sh index 81da0bf..faed9d3 100755 --- a/scripts/insert-nids.sh +++ b/scripts/insert-nids.sh @@ -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" \