Skip to content

Commit 21b4b43

Browse files
committed
Avoid warning on workflow_call triggers
Typically, we warn when there is no `push` trigger in the workflow file that triggered this run. However, when this action is triggered by a `workflow_call` event, we assume there is a custom process for triggering the action and we don't want to warn in this case.
1 parent 1e21373 commit 21b4b43

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

lib/workflow.js

+6-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/workflow.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/workflow.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import * as path from "path";
33
import zlib from "zlib";
44

55
import * as core from "@actions/core";
6+
import * as github from "@actions/github";
67
import * as yaml from "js-yaml";
78

89
import * as api from "./api-client";
@@ -219,7 +220,12 @@ export async function getWorkflowErrors(
219220
}
220221
}
221222

222-
if (missingPush) {
223+
// Avoid warning when there this action was triggered via workflow_call since
224+
// the user has a custom workflow that is calling this action and we assume
225+
// they know what they are doing.
226+
const isWorkflowCall = github.context.eventName === "workflow_call"
227+
228+
if (missingPush && !isWorkflowCall) {
223229
errors.push(WorkflowErrors.MissingPushHook);
224230
}
225231

0 commit comments

Comments
 (0)