diff --git a/.github/workflows/fossa-default.yml b/.github/workflows/fossa-default.yml index 9a36be8..f7c9430 100644 --- a/.github/workflows/fossa-default.yml +++ b/.github/workflows/fossa-default.yml @@ -23,6 +23,8 @@ jobs: ORG: ${{ github.repository_owner }} REPO: ${{ github.repository }} CUSTOM_PROPS_PAT: ${{ secrets.FOSSA_PAT }} + HAS_FOSSA_TARGETS: "" + FOSSA_ANALYZE_RESULT: "" steps: - uses: actions/checkout@v3 @@ -39,15 +41,16 @@ jobs: then echo "::error::fossa list-targets ran with errors." cat $LIST_TARGETS_ERR_FILE - echo "HAS_FOSSA_TARGETS=Error" >> "$GITHUB_OUTPUT" + echo "HAS_FOSSA_TARGETS=Error" >> "$GITHUB_ENV" elif [[ $(cat $LIST_TARGETS_OUT_FILE | wc -l) -gt 0 ]] then echo "::notice::Fossa found analysis targets." cat $LIST_TARGETS_OUT_FILE - echo "HAS_FOSSA_TARGETS=True" >> "$GITHUB_OUTPUT" + echo "HAS_FOSSA_TARGETS=True" >> "$GITHUB_ENV" else echo "::warning::Fossa did not find any analysis targets." - echo "HAS_FOSSA_TARGETS=False" >> "$GITHUB_OUTPUT" + echo "HAS_FOSSA_TARGETS=False" >> "$GITHUB_ENV" + echo "FOSSA_ANALYZE_RESULT=N/A" >> "$GITHUB_ENV" fi - name: Set fossaHasTargets custom property run: | @@ -57,7 +60,7 @@ jobs: -H "Authorization: Bearer $CUSTOM_PROPS_PAT" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/orgs/$ORG/properties/values \ - -d '{"repository_names":["'"${REPO##*/}"'"],"properties":[{"property_name":"fossaHasTargets","value":"'"${{ steps.fossa-list-targets.outputs.HAS_FOSSA_TARGETS }}"'"}]}' + -d '{"repository_names":["'"${REPO##*/}"'"],"properties":[{"property_name":"fossaHasTargets","value": "'"$HAS_FOSSA_TARGETS"'"]}' - id: fossa-analyze name: Run fossa analyze if: ${{ steps.fossa-list-targets.outputs.HAS_FOSSA_TARGETS == 'True'}} @@ -69,10 +72,10 @@ jobs: then echo "::error::fossa analyze ran with errors." cat $ANALYZE_ERR_FILE - echo "FOSSA_ANALYZE_RESULT=Error" >> "$GITHUB_OUTPUT" + echo "FOSSA_ANALYZE_RESULT=Error" >> "$GITHUB_ENV" else cat $ANALYZE_OUT_FILE - echo "FOSSA_ANALYZE_RESULT=Success" >> "$GITHUB_OUTPUT" + echo "FOSSA_ANALYZE_RESULT=Success" >> "$GITHUB_ENV" fi - name: Set fossaAnalyzeResult custom property run: | @@ -82,7 +85,7 @@ jobs: -H "Authorization: Bearer $CUSTOM_PROPS_PAT" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/orgs/$ORG/properties/values \ - -d '{"repository_names":["'"${REPO##*/}"'"],"properties":[{"property_name":"fossaAnalyzeResult","value":"'"${{ steps.fossa-analyze.outputs.FOSSA_ANALYZE_RESULT }}"'"}]}' + -d '{"repository_names":["'"${REPO##*/}"'"],"properties":[{"property_name":"fossaAnalyzeResult","value": "'"$FOSSA_ANALYZE_RESULT"'"]}' - name: Exit if: ${{ steps.fossa-list-targets.outputs.HAS_FOSSA_TARGETS == 'Error' || steps.fossa-analyze.outputs.FOSSA_ANALYZE_RESULT == 'Error' }} run: exit 1