mirror of
https://github.com/peaceiris/actions-gh-pages.git
synced 2026-10-05 19:11:36 +00:00
fix: order of checks in setGithubToken (#382)
- Fixes #358 - Related #359
This commit is contained in:
1 parent
c6333d41f0
commit
31cdbe5222
1 file changed
+4
-4
+4
-4
@@ -70,6 +70,10 @@ export function setGithubToken(
|
|||||||
core.debug(`eventName: ${eventName}`);
|
core.debug(`eventName: ${eventName}`);
|
||||||
let isProhibitedBranch = false;
|
let isProhibitedBranch = false;
|
||||||
|
|
||||||
|
if (externalRepository) {
|
||||||
|
throw new Error('GITHUB_TOKEN does not support to push to an external repository');
|
||||||
|
}
|
||||||
|
|
||||||
if (eventName === 'push') {
|
if (eventName === 'push') {
|
||||||
isProhibitedBranch = ref.includes(`refs/heads/${publishBranch}`);
|
isProhibitedBranch = ref.includes(`refs/heads/${publishBranch}`);
|
||||||
if (isProhibitedBranch) {
|
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`;
|
return `https://x-access-token:${githubToken}@github.com/${publishRepo}.git`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user