Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix: order of checks in setGithubToken (#382)
- Fixes #358
- Related #359
  • Loading branch information
Sarisia authored and GitHub committed Jul 8, 2020
1 parent c6333d4 commit 31cdbe5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/set-tokens.ts
Expand Up @@ -70,17 +70,17 @@ 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) {
throw new Error(`You deploy from ${publishBranch} to ${publishBranch}`);
}
}

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`;
}

Expand Down

0 comments on commit 31cdbe5

Please sign in to comment.