Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion .github/scripts/post-precommit-suggestions.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ module.exports = async ({ github, context, diff }) => {

// Only post a comment if there are new suggestions
if (newChanges.length > 0) {
let body = "Pre-commit found some formatting changes. You can apply each suggestion directly:\n\n";
let body = "**Pre-commit formatting suggestions**\n\n";
body += "Pre-commit hooks found some formatting changes. You can apply each suggestion directly:\n\n";

for (const change of newChanges) {
const { file, hunk, marker } = change;
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/pre-commit-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,12 @@ jobs:
- name: Post proposed changes
if: steps.get-diff.outputs.has_changes == 'true' && github.event_name == 'pull_request'
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # ratchet:actions/github-script@v8.0.0
env:
DIFF_CONTENT: ${{ steps.get-diff.outputs.diff_content }}
with:
script: |
const script = require('./.github/scripts/post-precommit-suggestions.js');
await script({ github, context, diff: `${{ steps.get-diff.outputs.diff_content }}` });
await script({ github, context, diff: process.env.DIFF_CONTENT });

# Fail the workflow if pre-commit failed
- name: Fail if pre-commit failed
Expand Down