Skip to content

Commit

Permalink
move check env to a reusable workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
elaguerta-nr committed May 27, 2024
1 parent 025d67a commit 16ad4d6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
17 changes: 17 additions & 0 deletions .github/workflows/fossa-check-env.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: FOSSA Check Env
on:
workflow_call:
secrets:
FOSSA_API_KEY:
required: true

jobs:
check_env:
runs-on: ubuntu-latest
env:
HAS_FOSSA_API_KEY: ${{ secrets.FOSSA_API_KEY != '' }}
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 }}
6 changes: 5 additions & 1 deletion .github/workflows/fossa-ruby-bundler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ on:
branches: [ $default-branch ]

jobs:
check_env:
uses: newrelic-csec/.github/.github/workflows/fossa-check-env.yml@reusable

fossa_ruby:
needs: check_env
if: ${{ needs.check_env.outputs.HAS_FOSSA_API_KEY == 'true' }}
runs-on: ubuntu-latest
env:
FOSSA_API_KEY: ${{secrets.FOSSA_API_KEY}}
Expand All @@ -20,5 +25,4 @@ jobs:
with:
ruby-version: '3.2'
- id: fossa-cli
if: ${{ env.FOSSA_API_KEY != '' }}
uses: newrelic-csec/.github/.github/composite/fossa-composite@reusable

0 comments on commit 16ad4d6

Please sign in to comment.