Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: trivy reusable workflow to use secrets #4

Merged
merged 1 commit into from
Jun 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions .github/workflows/trivy-fs-scan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ name: "Run TRIVY scan"
on:
workflow_call:
inputs:
github_token:
description: 'GitHub Token'
required: true
type: 'string'
skip_dirs:
description: 'A comma separated list of folders to ignore'
required: false
Expand Down Expand Up @@ -35,6 +31,9 @@ on:
required: false
type: 'string'
default: 'CRITICAL,HIGH'
secrets:
GITHUB_TOKEN:
required: true

permissions:
pull-requests: write
Expand Down Expand Up @@ -68,7 +67,7 @@ jobs:
- name: Report vulnerabilities in PR
if: ${{ inputs.prcomment && failure() && steps.scan.outcome == 'failure' }}
env:
GITHUB_TOKEN: ${{ inputs.github_token }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
echo -n "{\"body\":\"### Vulnerabilities detected\nThe following vulnerabilities of ${{ inputs.severity }} severity has been detected in the code. Please resolve these before merging the pull request.\n\n" > result.json
Expand All @@ -83,7 +82,7 @@ jobs:
- name: Report no vulnerabilities in PR
if: ${{ inputs.prcomment && success() && steps.scan.outcome == 'success' }}
env:
GITHUB_TOKEN: ${{ inputs.github_token }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
echo -n "{\"body\":\"### No vulnerabilities detected\nNo vulnerabilities of HIGH or CRITICAL severity has been detected in the code.\"}" > result.json
Expand Down