Skip to content

Commit 103a6a1

Browse files
committed
Fix PR commenting workflow
1 parent 9dc9211 commit 103a6a1

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

.github/workflows/pr-preview-comment.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
name: Comment on Fork PRs
22

33
on:
4-
pull_request:
4+
pull_request_target:
55
types: [opened, reopened, synchronize]
66

7+
# Required permissions for commenting on PRs
8+
permissions:
9+
contents: read
10+
pull-requests: write
11+
712
jobs:
813
comment-on-fork-pr:
914
runs-on: ubuntu-latest
@@ -16,7 +21,6 @@ jobs:
1621
script: |-
1722
const prNumber = context.payload.pull_request.number;
1823
const workflowUrl = `https://github.com/ruby/rdoc/actions/workflows/cloudflare-preview.yml`;
19-
const branch = context.payload.pull_request.head.ref;
2024
const commentMarker = "## Cloudflare Preview Deployment";
2125
2226
// Create a direct link that pre-fills the PR number input
@@ -38,9 +42,9 @@ jobs:
3842
const messageLines = [
3943
`${commentMarker}`,
4044
`⚠️ This PR is from a fork, so the preview deployment workflow doesn't run automatically for security reasons.`,
41-
`If you're a maintainer and want to preview this PR:`,
4245
``,
43-
`[➡️ Click here to run the workflow with PR #${prNumber} pre-filled](${dispatchUrl})`,
46+
`### For Maintainers:`,
47+
`[🚀 Click here to run the preview deployment workflow](${dispatchUrl})`,
4448
``,
4549
`This will trigger a Cloudflare Pages preview deployment for this PR.`
4650
];

0 commit comments

Comments
 (0)