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
1 changed files with 15 additions and 12 deletions

View File

@ -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);