File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- on : [push]
1+ on :
2+ push :
3+ pull_request_target :
4+ types : [opened, synchronize, reopened]
25
36jobs :
47 deploy :
710 permissions :
811 contents : read
912 deployments : write
13+ pull-requests : write
1014
1115 name : Deploy to Cloudflare Pages
1216
1317 steps :
1418 - name : Checkout
15- uses : actions/checkout@v3
19+ uses : actions/checkout@v4
20+ with :
21+ ref : ${{ github.event.pull_request.head.sha || github.sha }}
1622
1723 - name : Setup Ruby
1824 uses : ruby/setup-ruby@v1
@@ -25,11 +31,27 @@ jobs:
2531 JEKYLL_ENV : production
2632
2733 - name : Publish
34+ id : cloudflare
2835 uses : cloudflare/pages-action@v1.5.0
2936 with :
3037 apiToken : ${{ secrets.CLOUDFLARE_API_TOKEN }}
3138 accountId : ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
3239 projectName : ruby-uy
3340 directory : _site
34- gitHubToken : ${{ secrets.GITHUB_TOKEN }}
3541 wranglerVersion : ' 3'
42+ branch : ${{ github.event.pull_request.head.ref || github.ref_name }}
43+
44+ - name : Comment preview URL on PR
45+ if : github.event_name == 'pull_request_target'
46+ uses : actions/github-script@v7
47+ with :
48+ github-token : ${{ secrets.GITHUB_TOKEN }}
49+ script : |
50+ github.rest.issues.createComment({
51+ issue_number: context.issue.number,
52+ owner: context.repo.owner,
53+ repo: context.repo.repo,
54+ body: `🔍 Preview: ${process.env.DEPLOY_URL}`
55+ })
56+ env :
57+ DEPLOY_URL : ${{ steps.cloudflare.outputs.url }}
You can’t perform that action at this time.
0 commit comments