Skip to content

Commit d6bd618

Browse files
authored
fix: skip on fork if pull_request (#158)
cf. #157
1 parent 01fdaf2 commit d6bd618

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

src/main.ts

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,22 @@ export async function run(): Promise<void> {
1212
const inps: Inputs = getInputs();
1313
showInputs(inps);
1414

15-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
16-
const isForkRepository = (context.payload as any).repository.fork;
17-
const isSkipOnFork = await skipOnFork(
18-
isForkRepository,
19-
inps.GithubToken,
20-
inps.DeployKey,
21-
inps.PersonalToken
22-
);
23-
if (isSkipOnFork) {
24-
core.warning(
25-
'This action runs on a fork and not found auth token, Skip deployment'
15+
const eventName = context.eventName;
16+
if (eventName === 'pull_request') {
17+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
18+
const isForkRepository = (context.payload as any).repository.fork;
19+
const isSkipOnFork = await skipOnFork(
20+
isForkRepository,
21+
inps.GithubToken,
22+
inps.DeployKey,
23+
inps.PersonalToken
2624
);
27-
return;
25+
if (isSkipOnFork) {
26+
core.warning(
27+
'This action runs on a fork and not found auth token, Skip deployment'
28+
);
29+
return;
30+
}
2831
}
2932

3033
const remoteURL = await setTokens(inps);

0 commit comments

Comments
 (0)