mirror of
https://github.com/actions/github-script.git
synced 2025-12-08 16:16:21 +00:00
Fix PR test workflow for forks
When the workflow is triggered from a fork the permissions for the `GITHUB_TOKEN` are read-only. This chane skips the write operations if we're running from a fork. See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#pull-request-events-for-forked-repositories
This commit is contained in:
8
.github/workflows/pull-request-test.yml
vendored
8
.github/workflows/pull-request-test.yml
vendored
@@ -20,10 +20,9 @@ jobs:
|
||||
issue_number: context.payload.number,
|
||||
})
|
||||
|
||||
// Find any comment already made by the bot.
|
||||
const botComment = comments.find(comment => comment.user.id === 41898282)
|
||||
const commentBody = "Hello from actions/github-script! (${{ github.sha }})"
|
||||
|
||||
if (context.payload.pull_request.head.repo.full_name !== 'actions/github-script') {
|
||||
console.log('Not attempting to write comment on PR from fork');
|
||||
} else {
|
||||
if (botComment) {
|
||||
await github.issues.updateComment({
|
||||
owner: context.repo.owner,
|
||||
@@ -39,3 +38,4 @@ jobs:
|
||||
body: commentBody
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user