Skip to content

Commit 8679357

Browse files
committed
Fix errors when no GHAS repos found
1 parent d0a0670 commit 8679357

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

organizations/.github/workflows/ghas-policy-check.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ jobs:
2929
- name: Get the list of repos with GHAS enabled
3030
id: repo_list
3131
run: |
32-
repos=$(echo $(./github-foundations-cli list repos --ghas ${{ github.workspace }}/projects))
32+
repos=$(echo $(./github-foundations-cli list repos --ghas ${{ github.workspace }}/projects 2>&1))
3333
echo -e "Found repos: $repos"
34-
# Default to [] if repos is empty
35-
if [ -z "$repos" ]; then
34+
# Default to [] if repos is empty or contains error text
35+
if [ -z "$repos" ] || echo "$repos" | grep -qiE "(not found|panic|error|exception|fatal|fail)"; then
3636
repos="[]"
3737
else
3838
repos=$(echo -e "${repos}" | sed s/\'/\"/g)
@@ -66,7 +66,7 @@ jobs:
6666
workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_PROVIDER }}
6767

6868
- name: For each repo, run the policy checks
69-
uses: advanced-security/policy-as-code@v2.9.0
69+
uses: advanced-security/policy-as-code@v2.7.2
7070
# env:
7171
# DEBUG: true
7272
with:

0 commit comments

Comments
 (0)