From 7c9bbc47c2cd84fb703f19a57325d74782c82765 Mon Sep 17 00:00:00 2001 From: Will Hickey Date: Wed, 4 Sep 2024 09:01:27 -0500 Subject: [PATCH] Add early exit to add-team-to-ghsa (#2829) Add early exit to workflow if there are no teams that don't already have the team --- .github/scripts/add-team-to-ghsa.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/scripts/add-team-to-ghsa.sh b/.github/scripts/add-team-to-ghsa.sh index 41c1a787e85044..636888b02b7f02 100755 --- a/.github/scripts/add-team-to-ghsa.sh +++ b/.github/scripts/add-team-to-ghsa.sh @@ -15,6 +15,10 @@ ghsa_json=$(gh api \ # Get a list of GHSAs that don't have the $team_to_add_slug in collaborating_teams ghsa_without_team=$( jq -r '[ .[] | select(all(.collaborating_teams.[]; .slug != "'"$team_to_add_slug"'")) | .ghsa_id ] | sort | .[] ' <<< "$ghsa_json" ) +if [[ -z $ghsa_without_team ]]; then + echo "All GHSAs already have $team_to_add_slug. Exiting..." + exit 0 +fi # Iterate through the teams while IFS= read -r ghsa_id; do