-
Select Topic AreaQuestion BodyHello, in my org we've 15+ repos using actions and often multiple workflows. Things like https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ and https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/ are getting quite though to find. We're using dependabot but I still need to check to find the abandoned actions. Currently on the summary page of a run I see the collected deprecations as annotations at the bottom, but this is for one workflow. With 15+ repos and often multiple workflows, I'm looking at 50+ upwards to check, not including that I might miss some. Is there an easy way to figure this out? I looked at the API for https://docs.github.com/en/rest/actions/workflow-runs?apiVersion=2022-11-28 and also https://docs.github.com/en/rest/checks/runs?apiVersion=2022-11-28 , but I could not find anything straight forward. thanks |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
|
Actually figured a shell script of sorts using some of the APIs gets me there "good enough" to see if recently there were any annotations anywhere: # Get all repos
repos=$(gh api /orgs/ORGANIZATION/repos?sort=full_name --jq .[].full_name)
ago=$(date -r $(($(date +%s) - 10800)) -Iseconds)
for repo in $repos; do
echo "Checking repo $repo"
# For each repo, get the check suite ID
check_suite_ids=$(gh api "/repos/$repo/actions/runs?created=>=$ago" --jq .workflow_runs.[].check_suite_id)
# For each suite, get the annotation URLs
for check_suite_id in $check_suite_ids; do
annotation_urls=$(gh api "/repos/$repo/check-suites/$check_suite_id/check-runs" --jq .check_runs.[].output.annotations_url)
# from each annotation url, get the message
for url in $annotation_urls; do
message=$(gh api "$url" --jq .[].message)
if [[ -n "$message" ]]; then
echo "- $message"
fi
done
done
echo ""
doneIt's not prefect, during the run also showed some error but mostly got me there ;) |
Beta Was this translation helpful? Give feedback.
-
|
Nice @mfn! Not exactly the same as yours using check suites, but similar, I'm using a https://github.com/joshjohanning/github-actions-log-warning-checker |
Beta Was this translation helpful? Give feedback.
-
I slightly modified your Code to only display unique messages of the last to days, from all user repo (for orgs just use mfn's line): ago=$(date -r $(($(date +%s) - 2 * 24 * 60 * 60 )) -Iseconds)
repos=$(gh api "/users/${GITHUB_ACTOR}/repos?sort=full_name" --jq .[].full_name)
for repo in ${repos}; do
check_suite_ids=$(gh api "/repos/${repo}/actions/runs?created=>=${ago}" --jq .workflow_runs.[].check_suite_id)
declare -a messages=()
for check_suite_id in ${check_suite_ids}; do
annotation_urls=$(gh api "/repos/${repo}/check-suites/${check_suite_id}/check-runs" --jq .check_runs.[].output.annotations_url)
for url in ${annotation_urls}; do
run_message=$(gh api "$url" --jq .[].message)
if [[ -n "${run_message}" ]]; then
messages+=("${run_message}")
fi
done
done
if [ ${#messages[@]} -ne 0 ]; then
echo "${repo}:"
mapfile -t unique_messages < <( for i in "${messages[@]}"; do echo $i; done | sort -u )
for message in "${unique_messages[@]}"; do
echo " - ${message}"
done
echo ""
fi
unset messages
unset unique_messages
done |
Beta Was this translation helpful? Give feedback.
Actually figured a shell script of sorts using some of the APIs gets me there "good enough" to see if recently there were any annotations anywhere: