Skip to content
Merged
Show file tree
Hide file tree
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
15 changes: 14 additions & 1 deletion actions/setup/js/upload_artifact.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,20 @@ async function main(config = {}) {
};
}
} else {
core.info(`Staged mode: skipping artifact upload for slot ${i}`);
// Emit a staged mode preview summary.
let summaryContent = "## 🎭 Staged Mode: Upload Artifact Preview\n\n";
summaryContent += "The following artifact upload would be performed if staged mode was disabled:\n\n";
summaryContent += `**Artifact Name:** ${artifactName}\n\n`;
summaryContent += `**Files (${files.length}):**\n\n`;
for (const file of files) {
summaryContent += `- \`${file}\`\n`;
}
summaryContent += `\n**Total Size:** ${totalSize} bytes\n\n`;
summaryContent += `**Retention:** ${retentionDays} days\n\n`;
summaryContent += `> ℹ️ Upload skipped (staged mode active)\n\n`;

await core.summary.addRaw(summaryContent).write();
core.info("📝 Upload artifact preview written to step summary");
}

// Set step outputs so downstream jobs can reference the tmp ID.
Expand Down
14 changes: 14 additions & 0 deletions actions/setup/js/upload_artifact.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,20 @@ describe("upload_artifact.cjs", () => {
expect(results[0].success).toBe(true);
expect(mockArtifactClient.uploadArtifact).not.toHaveBeenCalled();
});

it("emits a staged mode preview summary when staged mode is active", async () => {
process.env.GH_AW_SAFE_OUTPUTS_STAGED = "true";
writeStaging("output.json");

await runHandler(buildConfig(), [{ type: "upload_artifact", path: "output.json" }]);

expect(mockCore.summary.addRaw).toHaveBeenCalled();
const summaryContent = mockCore.summary.addRaw.mock.calls[0][0];
expect(summaryContent).toContain("🎭 Staged Mode");
expect(summaryContent).toContain("Upload Artifact Preview");
expect(summaryContent).toContain("output.json");
expect(mockCore.summary.write).toHaveBeenCalled();
});
});

describe("resolver file", () => {
Expand Down
Loading