88
99on :
1010 issue_comment :
11- types : [created] # deleted, edited
11+ types : [created]
1212 pull_request_review_comment :
1313 types : [created]
1414
@@ -28,13 +28,11 @@ jobs:
2828 # /fmt comment from a trusted commenter in a PR
2929 if : |
3030 (
31- (
32- (github.event_name == 'issue_comment' && github.event.issue.pull_request != null) ||
33- (github.event_name == 'pull_request_review_comment')
34- ) &&
35- (github.event.comment.body == '/fmt' || startsWith(github.event.comment.body, '/fmt ')) &&
36- contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association)
37- )
31+ (github.event_name == 'issue_comment' && github.event.issue.pull_request != null) ||
32+ (github.event_name == 'pull_request_review_comment')
33+ ) &&
34+ (github.event.comment.body == '/fmt' || startsWith(github.event.comment.body, '/fmt ')) &&
35+ contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association)
3836 steps :
3937 - name : Checkout repository
4038 uses : actions/checkout@v4
@@ -86,13 +84,10 @@ jobs:
8684 echo '{"body": "Please apply the formatting suggestions.", "event": "COMMENT", "comments": []}' > payload.json
8785 for file in ${ALL_CHANGED_FILES}; do
8886 npx remark --quiet --frail --silently-ignore -o "$file"
89- # npx remark --quiet --frail --silently-ignore "$file" -o "${file}-output"
9087 ( # try
9188 git diff --quiet "$file"
92- # diff -q "$file" "${file}-output"
93- ) || ( # catch — formatter there are differences and formatting did something
89+ ) || ( # catch — there are differences and formatting did something
9490 jq_inplace payload.json ".comments += [{path: \"${file}\", subject_type: \"file\", side: \"RIGHT\", start_side: \"RIGHT\", commit_id: \"${COMMIT_ID}\", body: \"\`\`\`\`\`suggestion\\n$(cat "$file")\\n\`\`\`\`\`\"}]"
95- # jq_inplace payload.json ".comments += [{path: \"${file}\", subject_type: \"file\", side: \"RIGHT\", start_side: \"RIGHT\", commit_id: \"${COMMIT_ID}\", body: \"$(cat "${file}-output" | sed ':a;N;$!ba;s/\n/\\n/g')\"}]"
9691 )
9792 done
9893 COMMENTS_COUNT=$(jq -r '.comments | length' payload.json)
0 commit comments