mirror of
https://github.com/peaceiris/actions-gh-pages.git
synced 2025-07-14 14:16:00 +08:00
fix: order of checks in setGithubToken (#382)
- Fixes #358 - Related #359
This commit is contained in:
parent
c6333d41f0
commit
31cdbe5222
@ -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`;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user