From b41353009fcf8a65fa3a480d2ba512fece366870 Mon Sep 17 00:00:00 2001 From: peaceiris <30958501+peaceiris@users.noreply.github.com> Date: Mon, 16 Mar 2020 02:44:55 +0000 Subject: [PATCH] fix: skip on fork if pull_request --- src/main.ts | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/main.ts b/src/main.ts index 6d6e4035a..45fdc4dd1 100644 --- a/src/main.ts +++ b/src/main.ts @@ -12,19 +12,22 @@ export async function run(): Promise { 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);