Skip to content

Commit

Permalink
test reusable workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
SHession committed Jan 19, 2022
1 parent 25ca116 commit eba0751
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 25 deletions.
31 changes: 6 additions & 25 deletions .github/workflows/snyk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,12 @@ on:
schedule:
- cron: "0 6 * * *"
push:
branches:
- main
# branches:
# - main
workflow_dispatch:

jobs:
security:
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v2

- name: Get node version
run: echo NODE_VERSION=$(cat .nvmrc) >> $GITHUB_ENV

- uses: snyk/actions/setup@0.3.0
- uses: actions/setup-node@v2
with:
node-version: ${{ env.NODE_VERSION }}

- uses: actions/setup-java@v2
with:
java-version: "8"
distribution: "adopt"

- name: Snyk monitor
run: snyk monitor --all-projects
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
security:
uses: guardian/workflow-frontend/.github/workflows/test.yml@add-snyk-workflow
secrets:
blah: ${{ secrets.SNYK_TOKEN }}
40 changes: 40 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: SBT Node Snyk

on:
workflow_call:
inputs:
DEBUG:
type: string
required: false
secrets:
SNYK_TOKEN:
required: true

jobs:
security:
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v2

- name: Setup debug var
run: echo INPUT_DEBUG=${{ inputs.DEBUG }} >> $GITHUB_ENV
shell: bash

- name: Get node version
run: echo NODE_VERSION=$(cat .nvmrc) >> $GITHUB_ENV

- uses: snyk/actions/setup@0.3.0
- uses: actions/setup-node@v2
with:
node-version: ${{ env.NODE_VERSION }}

- uses: actions/setup-java@v2
with:
java-version: "8"
distribution: "adopt"

- name: Snyk monitor
run: snyk monitor --all-projects ${INPUT_DEBUG:+ -d}
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}

0 comments on commit eba0751

Please sign in to comment.