Skip to content

Commit

Permalink
Authentication for api access
Browse files Browse the repository at this point in the history
  • Loading branch information
nickynicolson committed Aug 24, 2022
1 parent 7bb65ee commit a46fea2
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions bin/download-ipni-oa-artifacts.bash
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
#!/bin/bash
USER=OA-WCVP \
REPO=ipni-oa \
USER=OA-WCVP
REPO=ipni-oa
GITHUB_API=https://api.github.com/repos/${USER}/${REPO}/releases/latest

token=${{ secrets.PAT }}
ARTIFACT=data
echo "Querying GitHub for the latest $ARCH release"
LATEST=$(curl -L -s -H 'Accept: application/json' $GITHUB_API)

echo "Querying GitHub for the latest $ARTIFACT artifact attached to $REPO release using $GITHUB_API"

#LATEST=$(curl -L -s -H 'Accept: application/json' $GITHUB_API)
LATEST=$(curl -L -s -H 'Accept: application/json' ${GITHUB_API}?access_token=${token})
LATEST_TAG=$(echo $LATEST_CURL | jq -r '.tag_name')
echo "Found version $LATEST_TAG" \
LATEST_URL=$(echo $LATEST | jq -r ".assets[] | select(.name | contains(\"$ARTIFACT\")) | .url")
echo "Downloading curl $LATEST_TAG from $USER"
curl -vLJO -H 'Accept: application/octet-stream' $LATEST_URL
curl -vLJO -H 'Accept: application/octet-stream' $LATEST_URL?access_token=${token}
ls -ltra

0 comments on commit a46fea2

Please sign in to comment.