Merge pull request #12 from SystangoTechnologies/fix/updatescript #40
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: Gitleaks Secret Scan | |
| on: | |
| push: | |
| branches: ["**"] | |
| pull_request: | |
| branches: ["**"] | |
| workflow_dispatch: | |
| jobs: | |
| gitleaks: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Run Gitleaks | |
| id: gitleaks | |
| uses: gitleaks/gitleaks-action@v2 | |
| with: | |
| config: .gitleaks.toml | |
| continue-on-error: true | |
| - name: Comment on PR if secrets detected | |
| if: github.event_name == 'pull_request' && steps.gitleaks.outcome == 'failure' | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| await github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: ` | |
| **Gitleaks Alert β Secrets Detected** | |
| @${context.actor} @${context.repo.owner} | |
| Secrets were detected in this pull request. | |
| Please remove them and rotate credentials immediately. | |
| **Commit:** ${context.sha} | |
| ` | |
| }); | |
| - name: Fail workflow if secrets detected | |
| if: steps.gitleaks.outcome == 'failure' | |
| run: exit 1 |