diff --git a/src/set-tokens.ts b/src/set-tokens.ts index bbb397f..97a36dd 100644 --- a/src/set-tokens.ts +++ b/src/set-tokens.ts @@ -70,6 +70,10 @@ export function setGithubToken( core.debug(`eventName: ${eventName}`); let isProhibitedBranch = false; + if (externalRepository) { + throw new Error('GITHUB_TOKEN does not support to push to an external repository'); + } + if (eventName === 'push') { isProhibitedBranch = ref.includes(`refs/heads/${publishBranch}`); if (isProhibitedBranch) { @@ -77,10 +81,6 @@ export function setGithubToken( } } - if (externalRepository) { - throw new Error('GITHUB_TOKEN does not support to push to an external repository'); - } - return `https://x-access-token:${githubToken}@github.com/${publishRepo}.git`; }