Skip to content

Commit

Permalink
fix: skip on fork if pull_request (#158)
Browse files Browse the repository at this point in the history
cf. #157
  • Loading branch information
peaceiris authored Mar 16, 2020
1 parent 01fdaf2 commit d6bd618
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,22 @@ export async function run(): Promise<void> {
const inps: Inputs = getInputs();
showInputs(inps);

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const isForkRepository = (context.payload as any).repository.fork;
const isSkipOnFork = await skipOnFork(
isForkRepository,
inps.GithubToken,
inps.DeployKey,
inps.PersonalToken
);
if (isSkipOnFork) {
core.warning(
'This action runs on a fork and not found auth token, Skip deployment'
const eventName = context.eventName;
if (eventName === 'pull_request') {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const isForkRepository = (context.payload as any).repository.fork;
const isSkipOnFork = await skipOnFork(
isForkRepository,
inps.GithubToken,
inps.DeployKey,
inps.PersonalToken
);
return;
if (isSkipOnFork) {
core.warning(
'This action runs on a fork and not found auth token, Skip deployment'
);
return;
}
}

const remoteURL = await setTokens(inps);
Expand Down

0 comments on commit d6bd618

Please sign in to comment.