name: Example Vulnerability Check on: push: branches: [ main ] pull_request: branches: [ main ] workflow_dispatch: # Allow manual triggering jobs: example: name: Check Example for Vulnerabilities runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v7 - name: Setup Go uses: actions/setup-go@v6 with: go-version: stable - name: Run govulncheck on example id: govulncheck uses: ./ with: working-directory: './example' # We expect the check to fail, since there are known vulnerabilities in the example code. # Therefore, we fail if no vulnerabilities are found. - name: Check for vulnerabilities if: steps.govulncheck.outputs.vulnerabilities-found != 'true' run: | echo "No vulnerabilities found, but we expected some in the example code." exit 1 - name: Demonstrate conditional failure run: | echo "In a real workflow, you might want to fail if vulnerabilities are found:" echo "if: steps.govulncheck.outputs.vulnerabilities-found == 'true'" echo "run: exit 1"