Created
December 19, 2023 22:40
-
-
Save jsoref/22df690ce9e1be7ff86534278fab6140 to your computer and use it in GitHub Desktop.
Get github repository workflow run logs
This file contains hidden or 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
gh_collect_repo_workflow_logs() { | |
OWNER="$1" | |
REPO="$2" | |
for workflow_run in $(gh api "/repos/$OWNER/$REPO/actions/runs" |jq -r -M '.workflow_runs[].id'); do | |
for job in $( | |
gh api "/repos/$OWNER/$REPO/actions/runs/$workflow_run/jobs" | jq '.jobs[].id' | |
); do | |
gh run view -R "$OWNER/$REPO" --log -j $job > "$workflow_run.$job.log" | |
done | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment