Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 39 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,44 @@ runs:
cat new-ignorefile.txt >> $GITHUB_OUTPUT
echo '```' >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT


- name: Create review suggestion for .infisicalignore
uses: actions/github-script@v7
if: env.SECRETS_FOUND == 'true' && env.FORKED == 'false' && inputs.ADD_COMMENT == 'true'
with:
github-token: ${{ inputs.GH_TOKEN }}
script: |

const fs = require('fs');

const suggestion =
fs.readFileSync('new-ignorefile.txt', 'utf8');

const suggestionBlock =
"```suggestion:.infisicalignore\n" +
Comment on lines +330 to +331
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

issue: GitHub suggestion code block syntax is likely incorrect with the :.infisicalignore suffix.

GitHub suggestions should use suggestion (optionally with a language), not `suggestion:.filename`. Using "suggestion\n" will make this render as an inline suggestion instead of a plain fenced code block.

suggestion +
"\n```";

const pr = context.payload.pull_request;

if (!pr) {
core.info("Not a PR event β€” skipping review suggestion.");
return;
}

await github.rest.pulls.createReview({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pr.number,
event: "COMMENT",
body:
"### Suggested update for `.infisicalignore`\n\n" +
"Apply this suggestion to ignore detected fingerprints:\n\n" +
suggestionBlock
});

core.info("Review suggestion posted successfully.");

- name: Update PR with comment (success)
uses: mshick/add-pr-comment@v3
if: env.SCAN_RAN == 'true' && env.SECRETS_FOUND == 'false' && env.FORKED == 'false' && inputs.ADD_COMMENT == 'true'
Expand Down Expand Up @@ -380,9 +417,7 @@ runs:
</details>

> [!TIP]
> You can commit the fingerprint list below to automatically create or update `.infisicalignore`:

${{ steps.ignore_suggestion.outputs.suggestion }}
> If you want to ignore these leaked secrets, add the above **fingerprint** content to a file named `.infisicalignore` at the repository root level.

- name: Update PR with comment (tool failure)
uses: mshick/add-pr-comment@v3
Expand Down
Loading