diff --git a/organizations/.github/workflows/ghas-policy-check.yaml b/organizations/.github/workflows/ghas-policy-check.yaml index 084c690..b6818e7 100644 --- a/organizations/.github/workflows/ghas-policy-check.yaml +++ b/organizations/.github/workflows/ghas-policy-check.yaml @@ -29,10 +29,10 @@ jobs: - name: Get the list of repos with GHAS enabled id: repo_list run: | - repos=$(echo $(./github-foundations-cli list repos --ghas ${{ github.workspace }}/projects)) + repos=$(echo $(./github-foundations-cli list repos --ghas ${{ github.workspace }}/projects 2>&1)) echo -e "Found repos: $repos" - # Default to [] if repos is empty - if [ -z "$repos" ]; then + # Default to [] if repos is empty or contains error text + if [ -z "$repos" ] || echo "$repos" | grep -qiE "(not found|panic|error|exception|fatal|fail)"; then repos="[]" else repos=$(echo -e "${repos}" | sed s/\'/\"/g)