From d6bd6182f264ce695613180743d42e377570bbf4 Mon Sep 17 00:00:00 2001 From: Shohei Ueda <30958501+peaceiris@users.noreply.github.com> Date: Mon, 16 Mar 2020 11:48:40 +0900 Subject: [PATCH] fix: skip on fork if pull_request (#158) cf. #157 --- 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);