@@ -141,16 +141,15 @@ jobs:
141
141
exit 1
142
142
fi
143
143
144
-
145
144
- name : Check for existing comment
146
145
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'
150
148
uses : actions/github-script@v6
151
149
id : find-comment
152
150
with :
153
151
script : |
152
+ console.log('Checking for existing comments...');
154
153
const { data: comments } = await github.rest.issues.listComments({
155
154
owner: context.repo.owner,
156
155
repo: context.repo.repo,
@@ -160,17 +159,18 @@ jobs:
160
159
comment.user.type === 'Bot' &&
161
160
comment.body.includes('Spellcheck has failed')
162
161
);
162
+ console.log('Found existing comment:', botComment ? botComment.id : 'none');
163
163
return botComment ? botComment.id : '';
164
164
result-encoding : string
165
165
166
166
- name : Post or update spell check comment
167
167
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'
171
170
uses : actions/github-script@v6
172
171
with :
173
172
script : |
173
+ console.log('Spell check log:', process.env.SPELL_LOG);
174
174
const message = `Spellcheck has failed. Please review the log and address the issues.
175
175
176
176
Here are a few tips:
@@ -186,14 +186,18 @@ jobs:
186
186
\`\`\``;
187
187
188
188
const commentId = '${{ steps.find-comment.outputs.result }}';
189
+ console.log('Comment ID:', commentId);
190
+
189
191
if (commentId) {
192
+ console.log('Updating existing comment');
190
193
await github.rest.issues.updateComment({
191
194
owner: context.repo.owner,
192
195
repo: context.repo.repo,
193
196
comment_id: parseInt(commentId),
194
197
body: message
195
198
});
196
199
} else {
200
+ console.log('Creating new comment');
197
201
await github.rest.issues.createComment({
198
202
owner: context.repo.owner,
199
203
repo: context.repo.repo,
@@ -202,4 +206,4 @@ jobs:
202
206
});
203
207
}
204
208
env :
205
- SPELL_LOG : ${{ steps.spellcheck.outputs.spell_log }}
209
+ SPELL_LOG : ${{ steps.spellcheck.outputs.spell_log }}
0 commit comments