Skip to content

Commit

Permalink
redirect output
Browse files Browse the repository at this point in the history
  • Loading branch information
paologalligit committed Sep 27, 2024
1 parent e6b7fd5 commit 2ac1935
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/gosec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ on:
jobs:
gosec:
runs-on: ubuntu-latest
continue-on-error: true
env:
GO111MODULE: on
outputs:
Expand All @@ -24,16 +23,17 @@ jobs:
id: gosec-run
uses: securego/gosec@master
with:
args: '-fmt json -exclude=G104,G115,G304,G406,G507 ./...'
args: '-exclude=G104,G115,G304,G406,G507 ./...'
- name: Capture Gosec Output
if: failure()
run: echo "gosec-output=$(echo "${{ steps.gosec-run.outputs.Issues }}")" >> $GITHUB_OUTPUT
continue-on-error: true
run: echo "gosec-output=error" >> $GITHUB_OUTPUT

notify-slack:
name: Notify Slack
needs:
- gosec
if: always() && needs.gosec.outputs.gosec-output.found != 0
if: always() && needs.gosec.outputs.gosec-output != 'error'
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand All @@ -46,5 +46,7 @@ jobs:
with:
payload: |
{
"gosec-output": "${{ needs.gosec.outputs.gosec-output || 'No issues found' }}",
"commit-url": "${{ github.event.head_commit.url }}",
"branch": "${{ github.ref }}",
"repository": "${{ github.repository }}",
}

0 comments on commit 2ac1935

Please sign in to comment.