fix: skip on fork if pull_request (#158)

cf. #157
This commit is contained in:
Shohei Ueda 2020-03-16 11:48:40 +09:00 committed by GitHub
parent 01fdaf2f02
commit d6bd6182f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,19 +12,22 @@ export async function run(): Promise<void> {
const inps: Inputs = getInputs(); const inps: Inputs = getInputs();
showInputs(inps); showInputs(inps);
// eslint-disable-next-line @typescript-eslint/no-explicit-any const eventName = context.eventName;
const isForkRepository = (context.payload as any).repository.fork; if (eventName === 'pull_request') {
const isSkipOnFork = await skipOnFork( // eslint-disable-next-line @typescript-eslint/no-explicit-any
isForkRepository, const isForkRepository = (context.payload as any).repository.fork;
inps.GithubToken, const isSkipOnFork = await skipOnFork(
inps.DeployKey, isForkRepository,
inps.PersonalToken inps.GithubToken,
); inps.DeployKey,
if (isSkipOnFork) { inps.PersonalToken
core.warning(
'This action runs on a fork and not found auth token, Skip deployment'
); );
return; if (isSkipOnFork) {
core.warning(
'This action runs on a fork and not found auth token, Skip deployment'
);
return;
}
} }
const remoteURL = await setTokens(inps); const remoteURL = await setTokens(inps);