Created
November 24, 2022 06:41
-
-
Save uemuraj/256bf27f6b054ae6155c4451c57fbbcd to your computer and use it in GitHub Desktop.
GitHub Actions の成果物をダウンロードする。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://docs.github.com/ja/rest/actions/artifacts の例をそのままスクリプトにしただけのもの。