Skip to content

Commit a1a72ab

Browse files
committed
Update spellcheck comment
1 parent a59c505 commit a1a72ab

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

.github/workflows/spelling.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -141,16 +141,15 @@ jobs:
141141
exit 1
142142
fi
143143
144-
145144
- name: Check for existing comment
146145
if: |
147-
failure() &&
148-
steps.spellcheck.outputs.spell_failed == 'true' &&
149-
github.event_name == 'pull_request'
146+
github.event_name == 'pull_request' &&
147+
steps.spellcheck.outputs.spell_failed == '1'
150148
uses: actions/github-script@v6
151149
id: find-comment
152150
with:
153151
script: |
152+
console.log('Checking for existing comments...');
154153
const { data: comments } = await github.rest.issues.listComments({
155154
owner: context.repo.owner,
156155
repo: context.repo.repo,
@@ -160,17 +159,18 @@ jobs:
160159
comment.user.type === 'Bot' &&
161160
comment.body.includes('Spellcheck has failed')
162161
);
162+
console.log('Found existing comment:', botComment ? botComment.id : 'none');
163163
return botComment ? botComment.id : '';
164164
result-encoding: string
165165

166166
- name: Post or update spell check comment
167167
if: |
168-
failure() &&
169-
steps.spellcheck.outputs.spell_failed == 'true' &&
170-
github.event_name == 'pull_request'
168+
github.event_name == 'pull_request' &&
169+
steps.spellcheck.outputs.spell_failed == '1'
171170
uses: actions/github-script@v6
172171
with:
173172
script: |
173+
console.log('Spell check log:', process.env.SPELL_LOG);
174174
const message = `Spellcheck has failed. Please review the log and address the issues.
175175
176176
Here are a few tips:
@@ -186,14 +186,18 @@ jobs:
186186
\`\`\``;
187187
188188
const commentId = '${{ steps.find-comment.outputs.result }}';
189+
console.log('Comment ID:', commentId);
190+
189191
if (commentId) {
192+
console.log('Updating existing comment');
190193
await github.rest.issues.updateComment({
191194
owner: context.repo.owner,
192195
repo: context.repo.repo,
193196
comment_id: parseInt(commentId),
194197
body: message
195198
});
196199
} else {
200+
console.log('Creating new comment');
197201
await github.rest.issues.createComment({
198202
owner: context.repo.owner,
199203
repo: context.repo.repo,
@@ -202,4 +206,4 @@ jobs:
202206
});
203207
}
204208
env:
205-
SPELL_LOG: ${{ steps.spellcheck.outputs.spell_log }}
209+
SPELL_LOG: ${{ steps.spellcheck.outputs.spell_log }}

0 commit comments

Comments
 (0)