@@ -12,19 +12,20 @@ import { filenameToPath, branchToSubdomain } from "./util";
1212
1313async function run ( ) : Promise < void > {
1414 try {
15- if ( ! process . env . GITHUB_TOKEN || ! process . env . GITHUB_REF_NAME ) {
16- core . setFailed ( `Could not find GITHUB_TOKEN or GITHUB_REF_NAME in env` ) ;
15+ if ( ! process . env . GITHUB_TOKEN ) {
16+ core . setFailed ( `Could not find GITHUB_TOKEN in env` ) ;
1717 process . exit ( ) ;
1818 }
1919
2020 const octokit = github . getOctokit ( process . env . GITHUB_TOKEN ) ;
2121 const ctx = github . context ;
22+ const branch = ctx . ref . replace ( "refs/heads/" , "" ) ;
2223
2324 core . info ( `Finding pull requests for ${ ctx . ref } ` ) ;
2425
2526 const { data : pulls } = await octokit . rest . pulls . list ( {
2627 ...ctx . repo ,
27- head : ctx . ref ,
28+ head : ` ${ ctx . repo . owner } : ${ branch } ` ,
2829 } ) ;
2930
3031 const pull_number = pulls . at ( 0 ) ?. number ;
@@ -63,12 +64,12 @@ async function run(): Promise<void> {
6364 }
6465
6566 const previewUrl = {
66- branch : `https://${ branchToSubdomain ( process . env . GITHUB_REF_NAME ) } .preview.developers.cloudflare.com` ,
67+ branch : `https://${ branchToSubdomain ( branch ) } .preview.developers.cloudflare.com` ,
6768 commit : `https://${ ctx . sha . slice ( 0 , 8 ) } .preview.developers.cloudflare.com` ,
6869 } ;
6970
7071 core . info (
71- `Commit URL: ${ previewUrl . commit } \nBranch URL:${ previewUrl . branch } ` ,
72+ `Commit URL: ${ previewUrl . commit } \nBranch URL: ${ previewUrl . branch } ` ,
7273 ) ;
7374
7475 const changedFiles = files
0 commit comments