Skip to content

Commit

Permalink
Avoid warning on workflow_call triggers
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
aeisenberg committed May 6, 2024
1 parent 1e21373 commit 21b4b43
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
7 changes: 6 additions & 1 deletion lib/workflow.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/workflow.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion src/workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as path from "path";
import zlib from "zlib";

import * as core from "@actions/core";
import * as github from "@actions/github";
import * as yaml from "js-yaml";

import * as api from "./api-client";
Expand Down Expand Up @@ -219,7 +220,12 @@ export async function getWorkflowErrors(
}
}

if (missingPush) {
// Avoid warning when there this action was triggered via workflow_call since
// the user has a custom workflow that is calling this action and we assume
// they know what they are doing.
const isWorkflowCall = github.context.eventName === "workflow_call"

Check notice

Code scanning / CodeQL

Semicolon insertion Note

Avoid automated semicolon insertion (95% of all statements in
the enclosing function
have an explicit semicolon).

if (missingPush && !isWorkflowCall) {
errors.push(WorkflowErrors.MissingPushHook);
}

Expand Down

0 comments on commit 21b4b43

Please sign in to comment.