Skip to content

Commit

Permalink
fixup: check env secrets and outputs
Browse files Browse the repository at this point in the history
Pass FOSSA_API_KEY secret from caller to check_env
Pass HAS_FOSSA_API_KEY output form check_end to caller
  • Loading branch information
elaguerta-nr committed May 27, 2024
1 parent fce066b commit 7342405
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/fossa-caos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
jobs:
check_env:
uses: newrelic-csec/.github/.github/workflows/fossa-check-env.yml@reusable
secrets:
FOSSA_API_KEY: ${{ secrets.FOSSA_API_KEY }}

fossa:
needs: check_env
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/fossa-check-env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@ on:
secrets:
FOSSA_API_KEY:
required: false
outputs:
HAS_FOSSA_API_KEY:
description: "True if FOSSA API key is available."
value: ${{ jobs.check_env.outputs.check }}

jobs:
check_env:
runs-on: ubuntu-latest
env:
HAS_FOSSA_API_KEY: ${{ secrets.FOSSA_API_KEY != '' }}
outputs:
HAS_FOSSA_API_KEY: ${{ steps.check-fossa-api-key.outputs.check }}
steps:
- id: check-fossa-api-key
run: echo "check=$HAS_FOSSA_API_KEY" >> "$GITHUB_OUTPUT"
outputs:
HAS_FOSSA_API_KEY: ${{ steps.check-fossa-api-key.outputs.check }}

3 changes: 2 additions & 1 deletion .github/workflows/fossa-default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ name: FOSSA CLI Analysis - Default
on:
pull_request:
branches: [ $default-branch ]
workflow_call:

jobs:
check_env:
uses: newrelic-csec/.github/.github/workflows/fossa-check-env.yml@reusable
secrets:
FOSSA_API_KEY: ${{ secrets.FOSSA_API_KEY }}

fossa:
needs: check_env
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/fossa-elixir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
jobs:
check_env:
uses: newrelic-csec/.github/.github/workflows/fossa-check-env.yml@reusable
secrets:
FOSSA_API_KEY: ${{ secrets.FOSSA_API_KEY }}

fossa:
needs: check_env
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/fossa-gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
jobs:
check_env:
uses: newrelic-csec/.github/.github/workflows/fossa-check-env.yml@reusable
secrets:
FOSSA_API_KEY: ${{ secrets.FOSSA_API_KEY }}

fossa:
needs: check_env
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/fossa-ruby-bundler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
jobs:
check_env:
uses: newrelic-csec/.github/.github/workflows/fossa-check-env.yml@reusable
secrets:
FOSSA_API_KEY: ${{ secrets.FOSSA_API_KEY }}

fossa_ruby:
needs: check_env
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/fossa-scala.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
jobs:
check_env:
uses: newrelic-csec/.github/.github/workflows/fossa-check-env.yml@reusable
secrets:
FOSSA_API_KEY: ${{ secrets.FOSSA_API_KEY }}

fossa:
needs: check_env
Expand Down

0 comments on commit 7342405

Please sign in to comment.