Skip to content

Instantly share code, notes, and snippets.

@iamazeem
Created December 22, 2023 07:22
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 iamazeem/50535166b00cdf255f6019f0590edc97 to your computer and use it in GitHub Desktop.
Save iamazeem/50535166b00cdf255f6019f0590edc97 to your computer and use it in GitHub Desktop.
Bash script to list repos with deprecated NodeJS 12 using annotations with GitHub CLI
#!/bin/bash
set -e
ORG=""
REPOS="$(gh repo list "$ORG" --json name --jq '.[] | join("")')"
NODEJS12_DEPRECATION_MSG="Node.js 12 actions are deprecated."
for REPO in $REPOS; do
echo -n "$ORG/$REPO "
ANNOTATIONS_JSON="$(gh annotations --repo "$ORG/$REPO" -json | jq -c '.')"
if [[ $ANNOTATIONS_JSON != "null" ]]; then
MESSAGE="$(jq '.[0].message' <<< "$ANNOTATIONS_JSON")"
if grep "$NODEJS12_DEPRECATION_MSG" <<< "$MESSAGE"; then
echo "[NOT OK] [DEPRECATION WARNING FOUND]"
else
echo "[OK] [OTHER ANNOTATIONS FOUND]"
fi
jq '.' <<< "$ANNOTATIONS_JSON"
echo "---"
else
echo "[OK] [NO ANNOTATIONS FOUND]"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment