You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
core.info( 'PR is from a fork, so we cannot create the changelog file automatically.' );
207
+
// For forks, we cannot create the file automatically, so we add a helpful comment to the PR,
208
+
// asking the contributor to create the file manually.
209
+
const commentBody = `👋 Thanks for your contribution!
210
+
211
+
I see you have provided all the required changelog information in your PR description. To complete the process, you'll need to create a changelog file in your branch.
212
+
213
+
Please create a file named \`.github/changelog/${number}-from-description\` with this content:
214
+
215
+
\`\`\`
216
+
${content}
217
+
\`\`\`
218
+
219
+
You can do this by either:
220
+
1. Running \`composer changelog:add\` in your local repository, or
221
+
2. Creating the file manually with the content above
222
+
223
+
Once you've committed and pushed the file to your PR branch, the checks will pass automatically.`;
224
+
225
+
// Check for existing comments first
226
+
let hasExistingComment = false;
227
+
for await ( const response of github.paginate.iterator( github.rest.issues.listComments, {
228
+
owner,
229
+
repo,
230
+
issue_number: +number,
231
+
per_page: 100,
232
+
} ) ) {
233
+
for ( const comment of response.data ) {
234
+
if ( comment.body.includes('👋 Thanks for your contribution!') ) {
235
+
hasExistingComment = true;
236
+
break;
237
+
}
238
+
}
239
+
if ( hasExistingComment ) {
240
+
core.info( 'A comment already exists, so we will not add another one.' );
241
+
break;
242
+
}
243
+
}
244
+
245
+
// Only post the comment if we haven't posted one before
246
+
if ( ! hasExistingComment ) {
247
+
core.info( 'No existing comment found, so we will add a new one.' );
248
+
await github.rest.issues.createComment( {
249
+
owner,
250
+
repo,
251
+
issue_number: number,
252
+
body: commentBody
253
+
} );
254
+
}
255
+
return;
256
+
}
257
+
201
258
try {
202
-
// Create or update the file in the repository
259
+
// For internal PRs, create the file automatically
0 commit comments