Skip to content

Commit

Permalink
ci: add gh slither action
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexey-N-Chernyshov committed Oct 13, 2023
1 parent 94eec2a commit da15a46
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/scripts/comment.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// The script that posts comments to PRs on gh
module.exports = async ({ github, context, header, body }) => {
module.exports = async ({ github, context, header, body, pr_number }) => {
const comment = [header, body].join("\n");

const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.number,
issue_number: pr_number,
});

const botComment = comments.find(
Expand Down
15 changes: 10 additions & 5 deletions .github/workflows/slither.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,26 @@ jobs:
id: slither
with:
fail-on: none
continue-on-error: true
sarif: results.sarif
slither-config: ethereum-bridge-contracts/slither.config.json
target: ethereum-bridge-contracts
slither-args: --checklist --markdown-root ${{ github.server_url }}/${{ github.repository }}/blob/${{ github.sha }}/

- name: ls
run: ls
- name: Push SARIF to DefectDojo
# TODO: push to DefectDojo
# run: ls results.sarif
run: echo ${{ github.event.number }}

- name: Create/update checklist as PR comment
uses: actions/github-script@v6
if: github.event_name == 'push'
env:
REPORT: ${{ steps.slither.outputs.stdout }}
PR_NUMBER: ${{ github.event.number }}
with:
script: |
const script = require('.github/scripts/comment')
const header = '# Slither report'
# const body = `${{ steps.slither.outputs.stdout }}`
# await script({ github, context, header, body })
const { REPORT } = process.env
const { PR_NUMBER } = process.env
await script({ github, context, header, body: REPORT, pr_number: PR_NUMBER })

0 comments on commit da15a46

Please sign in to comment.