@@ -20,24 +20,22 @@ jobs:
20
20
issue_number: context.payload.number,
21
21
})
22
22
23
- // Find any comment already made by the bot.
24
- const botComment = comments.find(comment => comment.user.id === 41898282)
25
- const commentBody = "Hello from actions/github-script! (${{ github.sha }})"
26
-
27
- console.log(context.payload.pull_request.head)
28
-
29
- if (botComment) {
30
- await github.issues.updateComment({
31
- owner: context.repo.owner,
32
- repo: context.repo.repo,
33
- comment_id: botComment.id,
34
- body: commentBody
35
- })
23
+ if (context.payload.pull_request.head.repo.full_name !== 'actions/github-script') {
24
+ console.log('Not attempting to write comment on PR from fork');
36
25
} else {
37
- await github.issues.createComment({
38
- owner: context.repo.owner,
39
- repo: context.repo.repo,
40
- issue_number: context.payload.number,
41
- body: commentBody
42
- })
26
+ if (botComment) {
27
+ await github.issues.updateComment({
28
+ owner: context.repo.owner,
29
+ repo: context.repo.repo,
30
+ comment_id: botComment.id,
31
+ body: commentBody
32
+ })
33
+ } else {
34
+ await github.issues.createComment({
35
+ owner: context.repo.owner,
36
+ repo: context.repo.repo,
37
+ issue_number: context.payload.number,
38
+ body: commentBody
39
+ })
40
+ }
43
41
}
0 commit comments