Skip to content

Instantly share code, notes, and snippets.

@uemuraj
Created November 24, 2022 06:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uemuraj/256bf27f6b054ae6155c4451c57fbbcd to your computer and use it in GitHub Desktop.
Save uemuraj/256bf27f6b054ae6155c4451c57fbbcd to your computer and use it in GitHub Desktop.
GitHub Actions の成果物をダウンロードする。
#!/bin/bash
OWNER=${1:?}
REPO=${2:?}
URL=`curl -sS -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${YOUR_TOKEN}" https://api.github.com/repos/${OWNER}/${REPO}/actions/artifacts | jq -r '.artifacts[0].archive_download_url'`
ZIP=$(mktemp)
curl -sS -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${YOUR_TOKEN}" -o ${ZIP} -L ${URL}
mkdir -p "${OWNER}/${REPO}"
unzip -j -o -d "${OWNER}/${REPO}" ${ZIP}
rm ${ZIP}
@uemuraj
Copy link
Author

uemuraj commented Nov 24, 2022

https://docs.github.com/ja/rest/actions/artifacts の例をそのままスクリプトにしただけのもの。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment