Skip to content

Add .infisicalignore commit suggestion support to PR comments +semver: major#160

Merged
guibranco merged 1 commit intomainfrom
guibranco-patch-1
Apr 12, 2026
Merged

Add .infisicalignore commit suggestion support to PR comments +semver: major#160
guibranco merged 1 commit intomainfrom
guibranco-patch-1

Conversation

@guibranco
Copy link
Copy Markdown
Owner

@guibranco guibranco commented Apr 12, 2026

📑 Description

This pull request enhances the Infisical secrets check action by adding an automated commit suggestion workflow that allows developers to create or update the .infisicalignore file directly from the pull request UI.

When leaked secrets are detected:

  • The action now checks whether .infisicalignore already exists in the repository
  • If the file exists, detected fingerprints are appended
  • If the file does not exist, the file is created automatically
  • Duplicate fingerprints are removed before generating suggestions
  • A GitHub Commit suggestion button is rendered inside the PR comment
  • Contributors can apply the ignore list without leaving the pull request interface

This significantly improves usability by turning the action into an interactive remediation workflow instead of only reporting scan results.

Why this is a major version bump

The PR comment output format changes by introducing a suggestion block that enables direct commits from the UI. While backwards compatible in behavior, this modifies the generated comment structure and downstream integrations relying on exact comment formatting may be affected.

✅ Checks

  • My pull request adheres to the code style of this project
  • My code requires changes to the documentation
  • I have updated the documentation as required
  • All the tests have passed

☢️ Does this introduce a breaking change?

  • Yes
  • No

Summary by Sourcery

Add support for suggesting .infisicalignore updates directly within PR comments when leaked secrets are detected.

New Features:

  • Generate a commit-ready .infisicalignore suggestion block in PR comments based on detected secret fingerprints.

Enhancements:

  • Automatically create or update the suggested .infisicalignore content by merging existing entries with new fingerprints and de-duplicating them.

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Apr 12, 2026

Reviewer's Guide

Adds an automated .infisicalignore commit-suggestion workflow to the Infisical secrets check GitHub Action, generating a de-duplicated ignore file suggestion block and embedding it in PR comments so contributors can directly commit ignore list changes from the PR UI.

Sequence diagram for Infisical .infisicalignore commit suggestion workflow

sequenceDiagram
    actor Developer
    participant GitHub
    participant InfisicalAction
    participant IgnorefileStep as Check_ignorefile_step
    participant SuggestionStep as Prepare_ignore_suggestion_step
    participant CommentAction as Add_PR_Comment_Action

    Developer->>GitHub: Push branch / open PR
    GitHub->>InfisicalAction: Run Infisical secrets check action
    InfisicalAction->>InfisicalAction: Scan for leaked secrets
    InfisicalAction->>InfisicalAction: Set env.SECRETS_FOUND

    alt Secrets found
        InfisicalAction->>IgnorefileStep: Execute when env.SECRETS_FOUND == true
        IgnorefileStep->>IgnorefileStep: Test for .infisicalignore
        IgnorefileStep-->>InfisicalAction: outputs.exists = true or false

        InfisicalAction->>SuggestionStep: Execute when env.SECRETS_FOUND == true
        alt .infisicalignore exists
            SuggestionStep->>SuggestionStep: Copy .infisicalignore to new-ignorefile.txt
            SuggestionStep->>SuggestionStep: Append fingerprint.txt
        else .infisicalignore missing
            SuggestionStep->>SuggestionStep: Initialize new-ignorefile.txt from fingerprint.txt
        end
        SuggestionStep->>SuggestionStep: sort -u new-ignorefile.txt (deduplicate)
        SuggestionStep-->>InfisicalAction: outputs.suggestion with ```suggestion:.infisicalignore block

        InfisicalAction->>CommentAction: Call mshick/add-pr-comment with suggestion
        CommentAction->>GitHub: Post PR comment with commit suggestion block
        Developer->>GitHub: Click Commit suggestion in PR comment
        GitHub->>GitHub: Apply patch to .infisicalignore (create or update)
    else No secrets found
        InfisicalAction->>CommentAction: Post success comment without suggestion
    end
Loading

Flow diagram for .infisicalignore suggestion generation logic

flowchart TD
    A[Start: Secrets scan completed] --> B{env.SECRETS_FOUND == 'true'?}
    B -- No --> Z[End: No ignore suggestion generated]
    B -- Yes --> C{.infisicalignore exists?}

    C -- Yes --> D[Copy existing .infisicalignore to new-ignorefile.txt]
    D --> E[Append newline to new-ignorefile.txt]
    E --> F[Append fingerprint.txt to new-ignorefile.txt]

    C -- No --> G[Create new-ignorefile.txt from fingerprint.txt]

    F --> H[Deduplicate entries: sort -u new-ignorefile.txt]
    G --> H

    H --> I[Begin suggestion output to GITHUB_OUTPUT]
    I --> J[Write line: ```suggestion:.infisicalignore]
    J --> K[Append contents of new-ignorefile.txt]
    K --> L[Write closing ```]
    L --> M[Write EOF marker for multiline output]
    M --> N[Step output: ignore_suggestion.outputs.suggestion]
    N --> O[PR comment embeds suggestion block]
    O --> P[Developer can commit suggestion from PR UI]
    P --> Z[End]
Loading

File-Level Changes

Change Details Files
Add workflow steps to detect existing .infisicalignore, build an updated ignore file from detected fingerprints, and output a GitHub suggestion block.
  • Introduce a step that checks for the existence of .infisicalignore when secrets are found and exposes the result via step outputs.
  • Add a step that constructs a new ignore file by either appending fingerprints to an existing .infisicalignore or creating a new one from fingerprint.txt.
  • Ensure duplicate fingerprints are removed from the generated ignore file by sorting and uniquing its contents.
  • Emit a formatted GitHub suggestion block containing the updated .infisicalignore contents to a step output for later use in PR comments.
action.yml
Update the PR comment content to include the generated suggestion block, enabling direct commit of .infisicalignore changes from the PR UI.
  • Replace the textual instruction about manually adding fingerprints to .infisicalignore with guidance to commit the generated fingerprint list.
  • Inject the suggestion block produced by the ignore_suggestion step into the PR comment so GitHub renders an inline Commit suggestion button.
action.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 12, 2026

Warning

Rate limit exceeded

@guibranco has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 14 minutes and 33 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 14 minutes and 33 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9ad8665b-5b5b-43c3-a4c0-a6d6578e2453

📥 Commits

Reviewing files that changed from the base of the PR and between ec6d891 and 5ef93de.

📒 Files selected for processing (1)
  • action.yml
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch guibranco-patch-1

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@guibranco guibranco enabled auto-merge (squash) April 12, 2026 13:15
@gstraccini gstraccini Bot added the ☑️ auto-merge Automatic merging of pull requests (gstraccini-bot) label Apr 12, 2026
@deepsource-io
Copy link
Copy Markdown

deepsource-io Bot commented Apr 12, 2026

DeepSource Code Review

We reviewed changes in ec6d891...5ef93de on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
Secrets Apr 12, 2026 1:15p.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

@penify-dev
Copy link
Copy Markdown
Contributor

penify-dev Bot commented Apr 12, 2026

Failed to generate code suggestions for PR

Repository owner deleted a comment from github-actions Bot Apr 12, 2026
@guibranco guibranco merged commit 3a8bfde into main Apr 12, 2026
15 of 16 checks passed
@guibranco guibranco deleted the guibranco-patch-1 branch April 12, 2026 13:16
@codacy-production
Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

TIP This summary will be updated as you push new changes. Give us feedback

@guibranco
Copy link
Copy Markdown
Owner Author

Infisical secrets check: ✅ No secrets leaked!

💻 Scan logs
2026-04-12T13:16:41Z INF scanning for exposed secrets...
1:16PM INF 142 commits scanned.
2026-04-12T13:16:41Z INF scan completed in 24.4ms
2026-04-12T13:16:41Z INF no leaks found

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've found 1 issue, and left some high level feedback:

  • Using sort -u on new-ignorefile.txt removes duplicates but also reorders the existing .infisicalignore contents, which may be surprising for users relying on a specific ordering; consider a de-duplication approach that preserves the original line order.
  • The temporary new-ignorefile.txt file is left in the workspace after the run; if you want to keep the workspace clean for later steps or debugging, consider either using mktemp in a subdirectory or removing the file once the suggestion output has been written.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Using `sort -u` on `new-ignorefile.txt` removes duplicates but also reorders the existing `.infisicalignore` contents, which may be surprising for users relying on a specific ordering; consider a de-duplication approach that preserves the original line order.
- The temporary `new-ignorefile.txt` file is left in the workspace after the run; if you want to keep the workspace clean for later steps or debugging, consider either using `mktemp` in a subdirectory or removing the file once the suggestion output has been written.

## Individual Comments

### Comment 1
<location path="action.yml" line_range="313" />
<code_context>
+        sort -u new-ignorefile.txt -o new-ignorefile.txt
+
+        echo "suggestion<<EOF" >> $GITHUB_OUTPUT
+        echo '```suggestion:.infisicalignore' >> $GITHUB_OUTPUT
+        cat new-ignorefile.txt >> $GITHUB_OUTPUT
+        echo '```' >> $GITHUB_OUTPUT
</code_context>
<issue_to_address>
**suggestion:** GitHub suggestion blocks don’t support specifying a filename, which may prevent this from rendering as an apply‑patch suggestion.

GitHub expects the marker to be exactly ```suggestion followed by the replacement text and then ``` on its own line. The `:.infisicalignore` suffix isn’t supported and will cause a plain code block instead of an interactive suggestion. To fix this, update the line to:

```bash
echo '```suggestion' >> $GITHUB_OUTPUT
```

so the output is treated as an apply‑patch suggestion.

```suggestion
        echo '```suggestion' >> $GITHUB_OUTPUT
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread action.yml
sort -u new-ignorefile.txt -o new-ignorefile.txt

echo "suggestion<<EOF" >> $GITHUB_OUTPUT
echo '```suggestion:.infisicalignore' >> $GITHUB_OUTPUT
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion: GitHub suggestion blocks don’t support specifying a filename, which may prevent this from rendering as an apply‑patch suggestion.

GitHub expects the marker to be exactly suggestion followed by the replacement text and then on its own line. The :.infisicalignore suffix isn’t supported and will cause a plain code block instead of an interactive suggestion. To fix this, update the line to:

echo '```suggestion' >> $GITHUB_OUTPUT

so the output is treated as an apply‑patch suggestion.

Suggested change
echo '```suggestion:.infisicalignore' >> $GITHUB_OUTPUT
echo '```suggestion' >> $GITHUB_OUTPUT

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

Labels

☑️ auto-merge Automatic merging of pull requests (gstraccini-bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant