---
name: Snyk Clojure Merge

on: push

jobs:
 snyk_clojure:
   runs-on: ubuntu-latest
   steps:
    - name: Connect to Twingate
      uses: twingate/github-action@v1
      with:
        service-key: ${{ secrets.TWINGATE_PUBLIC_REPO_KEY }}
    - name: checkout the current PR
      uses: actions/checkout@v2
      with:
        fetch-depth: 1
        persist-credentials: false
    - name: Run Clojure Snyk Scan
      id: scan
      uses: puppetlabs/security-snyk-clojure-action@v2
      with:
        snykToken: ${{ secrets.SNYK_PE_TOKEN }}
        snykOrg: 'puppet-enterprise'
        snykProject: 'clj-http-client'
        # snykPolicy: '.snyk'
    - name: Check output
      if: steps.scan.outputs.vulns != ''
      run: echo "Vulnerabilities detected; ${{ steps.scan.outputs.vulns }}" && exit 1
