fix: order of checks in setGithubToken (#382)
- Fixes #358 - Related #359
This commit is contained in:
@@ -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`;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user