Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions actions/setup/js/dispatch_workflow.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,7 @@ async function main(config = {}) {

processedCount++;

const item = message;
const workflowName = item.workflow_name;
const workflowName = message.workflow_name;

if (!workflowName || workflowName.trim() === "") {
core.warning("Workflow name is empty, skipping");
Expand Down Expand Up @@ -151,8 +150,8 @@ async function main(config = {}) {
// Prepare inputs - convert all values to strings as required by workflow_dispatch
/** @type {Record<string, string>} */
const inputs = {};
if (item.inputs && typeof item.inputs === "object") {
for (const [key, value] of Object.entries(item.inputs)) {
if (message.inputs && typeof message.inputs === "object") {
for (const [key, value] of Object.entries(message.inputs)) {
// Convert value to string
if (value === null || value === undefined) {
inputs[key] = "";
Expand Down Expand Up @@ -194,10 +193,10 @@ async function main(config = {}) {
/** @type {any} */
const err = dispatchError;
const status = err && typeof err === "object" ? err.status : undefined;
const message = err && typeof err === "object" && err.response && err.response.data && typeof err.response.data.message === "string" ? err.response.data.message : String(dispatchError);
const dispatchErrMessage = typeof err?.response?.data?.message === "string" ? err.response.data.message : String(dispatchError);

const isValidationStatus = status === 400 || status === 422;
const mentionsReturnRunDetails = typeof message === "string" && message.toLowerCase().includes("return_run_details");
const mentionsReturnRunDetails = typeof dispatchErrMessage === "string" && dispatchErrMessage.toLowerCase().includes("return_run_details");

if (isValidationStatus && mentionsReturnRunDetails) {
core.info("Workflow dispatch failed due to unsupported 'return_run_details' parameter; retrying without it for GitHub Enterprise compatibility.");
Expand Down
Loading