Created
December 22, 2023 07:22
-
-
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
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 | |
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