Skip to content

Commit

Permalink
fix: order of checks in setGithubToken (#382)
Browse files Browse the repository at this point in the history
- Fixes #358
- Related #359
  • Loading branch information
sarisia 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
Original file line number Diff line number Diff line change
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.