Skip to content

Fix Gitleaks PR scan workflow after action token requirement change - #19

Merged
donny-devops merged 2 commits into
mainfrom
copilot/fix-gitleaks-secret-scan
Jul 12, 2026
Merged

Fix Gitleaks PR scan workflow after action token requirement change#19
donny-devops merged 2 commits into
mainfrom
copilot/fix-gitleaks-secret-scan

Conversation

Copilot AI commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

The Gitleaks secret scan GitHub Actions job was failing before any scan ran because gitleaks/gitleaks-action@v2 now requires GITHUB_TOKEN on pull_request events. The workflow also passed an unsupported args input that was ignored at runtime.

  • Workflow fix

    • pass GITHUB_TOKEN to the gitleaks step via env
    • add job-local read permissions required for PR metadata access
    • disable PR comment publishing to keep the job read-only
  • Cleanup

    • remove the unused with.args entry that the action does not accept
  • Result

    • restores PR secret scanning without broadening repository permissions
    • removes the runtime warning from the gitleaks step
gitleaks-scan:
  permissions:
    contents: read
    pull-requests: read
  steps:
    - uses: gitleaks/gitleaks-action@v2
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        GITLEAKS_ENABLE_COMMENTS: false

@donny-devops
donny-devops requested a review from Copilot July 12, 2026 21:27
@sonarqubecloud

Copy link
Copy Markdown

@donny-devops
donny-devops marked this pull request as ready for review July 12, 2026 21:28
@donny-devops
donny-devops self-requested a review as a code owner July 12, 2026 21:28
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@donny-devops
donny-devops merged commit a46bd91 into main Jul 12, 2026
15 checks passed
@donny-devops
donny-devops deleted the copilot/fix-gitleaks-secret-scan branch July 12, 2026 21:28
Copilot AI restored the copilot/fix-gitleaks-secret-scan branch July 12, 2026 21:28
@donny-devops
donny-devops deleted the copilot/fix-gitleaks-secret-scan branch July 12, 2026 21:28
Copilot AI changed the title [WIP] Fix failing GitHub Actions job "Gitleaks secret scan" Fix Gitleaks PR scan workflow after action token requirement change Jul 12, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts the CI workflow’s Gitleaks secret scan job configuration to address a failing GitHub Actions run by changing how the gitleaks/gitleaks-action@v2 step is invoked and reducing GitHub token permissions/commenting behavior.

Changes:

  • Adds an explicit, restricted permissions: block for the gitleaks-scan job.
  • Sets GITLEAKS_ENABLE_COMMENTS: false and provides GITHUB_TOKEN to the Gitleaks action via env.
  • Removes the previously configured explicit Gitleaks CLI args (including --redact and --verbose).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/ci.yml
Comment on lines 71 to +75
- name: Run Gitleaks
uses: gitleaks/gitleaks-action@v2
with:
args: detect --source . --verbose --redact
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITLEAKS_ENABLE_COMMENTS: false

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e64dfacee0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/ci.yml
@@ -67,5 +70,6 @@ jobs:

- name: Run Gitleaks
uses: gitleaks/gitleaks-action@v2

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Upgrade the Gitleaks action runtime

On GitHub-hosted ubuntu-latest runs after June 2, 2026, this step still invokes gitleaks-action@v2; the upstream action README says v2 uses Node 20 and will fail unless ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION=true is set, and this workflow does not set that opt-out. As a result, the Gitleaks job can remain broken before it reaches the token/comment changes; upgrade to gitleaks-action@v3 instead of keeping v2 here.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants