Merge pull request #264 from owieth/dependabot/npm_and_yarn/prettier-… #558
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Slither Analysis | |
| on: [push] | |
| jobs: | |
| analyze: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v7 | |
| with: | |
| submodules: recursive | |
| - name: Run Slither | |
| uses: crytic/slither-action@v0.4.2 | |
| id: slither | |
| with: | |
| node-version: 20 | |
| fail-on: medium | |
| slither-args: --checklist --markdown-root ${{ github.server_url }}/${{ github.repository }}/blob/${{ github.sha }}/ | |
| - name: Create/update checklist as PR comment | |
| uses: actions/github-script@v9 | |
| if: github.event_name == 'pull_request' | |
| env: | |
| REPORT: ${{ steps.slither.outputs.stdout }} | |
| with: | |
| script: | | |
| const header = '# Slither report' | |
| const body = process.env.REPORT | |
| const comment = [header, body].join('\n\n') | |
| const { data: comments } = await github.rest.issues.listComments({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| }) | |
| const existing = comments.find(c => c.body.startsWith(header)) | |
| if (existing) { | |
| await github.rest.issues.updateComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| comment_id: existing.id, | |
| body: comment, | |
| }) | |
| } else { | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body: comment, | |
| }) | |
| } |