diff --git a/actions/setup/js/upload_artifact.cjs b/actions/setup/js/upload_artifact.cjs index a92d14794da..f387e226337 100644 --- a/actions/setup/js/upload_artifact.cjs +++ b/actions/setup/js/upload_artifact.cjs @@ -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. diff --git a/actions/setup/js/upload_artifact.test.cjs b/actions/setup/js/upload_artifact.test.cjs index 88dd7cf5cb1..d260f0515f1 100644 --- a/actions/setup/js/upload_artifact.test.cjs +++ b/actions/setup/js/upload_artifact.test.cjs @@ -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", () => {