File tree Expand file tree Collapse file tree 2 files changed +26
-14
lines changed
Expand file tree Collapse file tree 2 files changed +26
-14
lines changed Original file line number Diff line number Diff line change 11#! /bin/bash
2- set -e
2+ set -ex
3+
4+ function log() {
5+ echo " $1 " >&2
6+ }
37
48job_id=" $1 "
5- raw_log_url=$( curl -Ls -o /dev/null \
9+ api_url=" https://api.github.com/repos/$GITHUB_REPOSITORY /actions/jobs/$job_id /logs"
10+ log " $api_url "
11+
12+ raw_log_url=$( curl -Ls --fail --show-error -o /dev/null \
613 -w %{url_effective} \
714 -H " Accept: application/vnd.github+json" \
815 -H " Authorization: Bearer $GITHUB_TOKEN " \
916 -H " X-GitHub-Api-Version: 2022-11-28" \
10- https://api.github.com/repos/ ${GITHUB_REPOSITORY} /actions/jobs/ $job_id /logs
17+ " $api_url "
1118)
12- archived_url=$( curl -L -s -o /dev/null -w " %header{link}" " http://web.archive.org/save/$raw_log_url " \
19+ archived_url=$( curl -L -s --fail --show-error - o /dev/null -w " %header{link}" " http://web.archive.org/save/$raw_log_url " \
1320 | awk ' /^</ {
1421 split($0, links, ",")
15-
22+
1623 for(i=1; i<=length(links); i++) {
1724 link = links[i]
18-
25+
1926 gsub(/<|>/, "", link) # remove angle brackets
2027 gsub(/^ *| *$/, "", link) # remove leading/trailing whitespace
21-
28+
2229 if(link ~ "rel=\"memento\"") {
2330 split(link, parts, ";")
2431 gsub(/^http:/, "https:", parts[1])
Original file line number Diff line number Diff line change 11#! /bin/bash
2+ set -e
3+
4+ function log() {
5+ echo " $1 " >&2
6+ }
27
38job_name=Publish
49step_name=" Create Checksums"
5- job=$( curl -Ls \
6- -H " Accept: application/vnd.github+json" \
7- -H " Authorization: Bearer $GITHUB_TOKEN " \
8- -H " X-GitHub-Api-Version: 2022-11-28" \
9- https://api.github.com/repos/$GITHUB_REPOSITORY /actions/runs/$GITHUB_RUN_ID /attempts/$GITHUB_RUN_ATTEMPT /jobs \
10- | jq -r " .jobs[] | select(.name==\" $job_name \" )"
11- )
10+ api_url=" /repos/$GITHUB_REPOSITORY /actions/runs/$GITHUB_RUN_ID /attempts/$GITHUB_RUN_ATTEMPT /jobs"
11+ log " $api_url "
12+
13+ job=$( gh api " $api_url " --jq " .jobs[] | select(.name==\" $job_name \" )" )
14+ [[ -z " $job " ]] && { log " Job '$job_name ' not found" ; exit 1; }
15+
1216run_url=$( echo " $job " | jq -r .html_url)
1317checksum_number=$( echo " $job " | jq " .steps[] | select(.name==\" $step_name \" ) | .number" )
18+ [[ -z " $checksum_number " ]] && { log " Step '$step_name '.number not found" ; exit 1; }
1419
1520echo " checksum_url=$run_url #step:$checksum_number :1"
1621echo " job_id=$GITHUB_JOB "
You can’t perform that action at this time.
0 commit comments