@@ -15,12 +15,15 @@ checkInputs().then(() => {
1515async function checkInputs ( ) {
1616 const eventPath = process . env . GITHUB_EVENT_PATH ,
1717 event = eventPath && require ( eventPath ) ,
18+ token = process . env . GITHUB_TOKEN ,
1819 isPR = process . env . GITHUB_EVENT_NAME ?. includes ( 'pull_request' ) ,
1920 sha = ( event ?. pull_request ?. head ?. sha || process . env . GITHUB_SHA ) as string ,
2021 defaultRef = isPR
2122 ? event ?. pull_request ?. head ?. ref as string
2223 : process . env . GITHUB_REF ?. substring ( 11 )
2324
25+ if ( ! token ) warning ( 'The GITHUB_TOKEN env variable is missing: the action may not work as expected.' )
26+
2427 const actualRef = setDefault ( 'ref' , defaultRef || '' )
2528
2629 let author = event ?. head_commit ?. author
@@ -29,8 +32,8 @@ async function checkInputs() {
2932
3033 // https://docs.github.com/en/rest/reference/repos#get-a-commit--code-samples
3134 const url = `https://api.github.com/repos/${ process . env . GITHUB_REPOSITORY } /commits/${ sha } ` ,
32- headers = process . env . GITHUB_TOKEN ? {
33- Authorization : `Bearer ${ process . env . GITHUB_TOKEN } `
35+ headers = token ? {
36+ Authorization : `Bearer ${ token } `
3437 } : undefined ,
3538 commit = ( await axios . get ( url , { headers } ) . catch ( err => {
3639 info ( '::group::Request error:' )
0 commit comments