Skip to content

Commit

Permalink
fix: test for catalog present
Browse files Browse the repository at this point in the history
Signed-off-by: Lou DeGenaro <[email protected]>
  • Loading branch information
degenaro committed Nov 28, 2023
1 parent 5f8d5ab commit 7997a04
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 13 deletions.
25 changes: 12 additions & 13 deletions .github/workflows/main-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,31 +28,30 @@ jobs:
runs-on: ubuntu-latest
needs: release
steps:
- name: Check for initialized
id: file_check
run: |
if ls -l catalogs | wc -l != 0; then
echo "check_result=true" >> $GITHUB_OUTPUT
else
echo "check_result=false" >> $GITHUB_OUTPUT
fi
- name: Clone branch
if: steps.file_check.outputs.check_result == 'true'
uses: actions/checkout@v2
with:
fetch-depth: 0
ref: main
token: ${{ secrets.GIT_TOKEN }}
- name: Determine initialization status
id: determine_initialization_status
run: |
set +e
bash scripts/automation/check_catalog.sh
exitcode="$?"
echo "exitcode: $exitcode"
echo "exitcode=$exitcode" >> $GITHUB_OUTPUT
- name: Clone downstream repo
if: steps.file_check.outputs.check_result == 'true'
if: steps.determine_initialization_status.outputs.exitcode == '1'
uses: actions/checkout@v2
with:
repository: my-repo-base/my-profile
path: './my-profile'
repository: degenaro/acme-profile-nist-800-53
path: 'acme-profile-nist-800-53'
token: ${{ secrets.GIT_TOKEN }}
fetch-depth: 0
- name: Update profiles
if: steps.file_check.outputs.check_result == 'true'
if: steps.determine_initialization_status.outputs.exitcode == '1'
run: bash scripts/automation/update_downstream.sh
env:
GH_TOKEN: ${{ secrets.GIT_TOKEN }}
Expand Down
13 changes: 13 additions & 0 deletions scripts/automation/check_catalog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

source config.env

RESULT=$(ls catalogs)

if [[ "$RESULT" == *"$CATALOG"* ]]; then
echo "catalog exists, exit 1";
exit 1;
else
echo "catalog does not exist, exit 0"
exit 0;
fi

0 comments on commit 7997a04

Please sign in to comment.