From 775e39825e2f7919aa395e19b1694bfe01e6025c Mon Sep 17 00:00:00 2001 From: sarisia Date: Thu, 9 Jul 2020 04:04:04 +0900 Subject: [PATCH] fix order of checks in setGithubToken --- src/set-tokens.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/set-tokens.ts b/src/set-tokens.ts index bbb397f2e..97a36ddfd 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`; }