Skip to content

[WIP] Update generated footer to include gh-aw-workflow-call-id#19525

Merged
pelikhan merged 4 commits intomainfrom
copilot/update-generated-footer
Mar 4, 2026
Merged

[WIP] Update generated footer to include gh-aw-workflow-call-id#19525
pelikhan merged 4 commits intomainfrom
copilot/update-generated-footer

Conversation

Copy link
Contributor

Copilot AI commented Mar 4, 2026

  • Add generateWorkflowCallIdMarker import to add_comment.cjs
  • Append gh-aw-workflow-call-id marker to comment body after footer generation when callerWorkflowId is set
  • Add test to add_comment.test.cjs verifying the marker is included when GH_AW_CALLER_WORKFLOW_ID is set
  • Add test to add_comment.test.cjs verifying the marker is absent when GH_AW_CALLER_WORKFLOW_ID is not set
  • Run lint/format validation (all pass)

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.



✨ PR Review Safe Output Test - Run 22657504616

💥 [THE END] — Illustrated by Smoke Claude ·

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

✅ All tools validated successfully! Agent Container Smoke Test confirms agent container is ready.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

🌑 The shadows whisper... Smoke Codex failed. The oracle requires further meditation...

@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

📰 BREAKING: Smoke Copilot is now investigating this pull request. Sources say the story is developing...

@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

🎬 THE ENDSmoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨

@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

Agent Container Tool Check

Tool Status Version
bash 5.2.21
sh available
git 2.53.0
jq 1.7
yq v4.52.4
curl 8.5.0
gh 2.87.3
node v20.20.0
python3 3.12.3
go 1.24.13
java 10.0.102
dotnet 10.0.102

Result: 12/12 tools available ✅

Overall Status: PASS

🔧 Tool validation by Agent Container Smoke Test ·

@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

Commit pushed: b1f5877

Generated by Changeset Generator

@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

Smoke Test: Copilot - 22657504683

Test Status
GitHub MCP
Safe Inputs GH CLI
Serena MCP
Playwright
Web Fetch
File Writing
Bash Tool
Discussion Interaction
Build gh-aw
Discussion Creation
Workflow Dispatch
PR Review

Overall: ⚠️ PARTIAL PASS (Serena MCP unavailable)

PR by @Copilot · Assignees: @pelikhan @Copilot

📰 BREAKING: Report filed by Smoke Copilot ·

@github-actions github-actions bot removed the smoke label Mar 4, 2026
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed PR #19525: [WIP] Update generated footer to include gh-aw-workflow-call-id. The changes correctly add the gh-aw-workflow-call-id marker to comment bodies when GH_AW_CALLER_WORKFLOW_ID is set, with good test coverage for both cases. Minor suggestion: add edge case test for empty string env var.

📰 BREAKING: Report filed by Smoke Copilot

it("should not include gh-aw-workflow-call-id marker when GH_AW_CALLER_WORKFLOW_ID is not set", async () => {
const addCommentScript = fs.readFileSync(path.join(__dirname, "add_comment.cjs"), "utf8");

process.env.GH_AW_WORKFLOW_NAME = "Test Workflow";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good test coverage for both the positive case (marker present when env var set) and negative case (marker absent when env var not set). Consider also testing the edge case where GH_AW_CALLER_WORKFLOW_ID is set to an empty string.

// Add workflow-call-id marker when available to allow close-older-comments to
// distinguish callers that share the same reusable workflow (and GH_AW_WORKFLOW_ID)
if (callerWorkflowId) {
processedBody += "\n" + generateWorkflowCallIdMarker(callerWorkflowId);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow-call-id marker is correctly placed after the XML marker. This enables close-older-comments to distinguish between different callers sharing the same reusable workflow — a clean solution to the caller disambiguation problem.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤

@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

Smoke Test Results — Run §22657504616

Core Tests (#1–10): ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
PR Review Tests (#11–17): ✅ ✅ ✅ ⚠️ ✅ ✅ ⚠️

Legend
Pass
⚠️ Skipped (#14 no threads, #17 triggering PR)

Overall: PARTIAL (15 passed, 2 skipped, 0 failed)

💥 [THE END] — Illustrated by Smoke Claude ·

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💥 Automated smoke test review - all systems nominal!

💥 [THE END] — Illustrated by Smoke Claude

@pelikhan pelikhan marked this pull request as ready for review March 4, 2026 06:27
Copilot AI review requested due to automatic review settings March 4, 2026 06:28
@pelikhan pelikhan merged commit 8c53fd1 into main Mar 4, 2026
49 checks passed
@pelikhan pelikhan deleted the copilot/update-generated-footer branch March 4, 2026 06:28
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the add-comment safe output footer/metadata so comments can be disambiguated by calling workflow identity (useful when multiple workflows share the same reusable workflow).

Changes:

  • Append a gh-aw-workflow-call-id XML marker to generated comment bodies when GH_AW_CALLER_WORKFLOW_ID is set.
  • Add tests covering presence/absence of the marker based on GH_AW_CALLER_WORKFLOW_ID.
  • Add a changeset documenting the patch behavior change.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
actions/setup/js/add_comment.cjs Appends the workflow-call-id marker after footer generation when caller workflow ID is available.
actions/setup/js/add_comment.test.cjs Adds assertions that the marker is included/excluded depending on GH_AW_CALLER_WORKFLOW_ID.
.changeset/patch-add-workflow-call-id-marker.md Declares a patch release describing the new marker behavior.
Comments suppressed due to low confidence (1)

actions/setup/js/add_comment.test.cjs:1347

  • Same teardown concern here: deleting env vars at the end of the test can leak state if the test fails before reaching these lines. Using afterEach/finally for GH_AW_WORKFLOW_NAME (and any related env) would make failures easier to debug.
      delete process.env.GH_AW_WORKFLOW_NAME;
    });

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +1285 to +1346
process.env.GH_AW_WORKFLOW_NAME = "Test Workflow";
process.env.GH_AW_CALLER_WORKFLOW_ID = "owner/repo/TestWorkflow";

let capturedBody = null;
mockGithub.rest.issues.createComment = async params => {
capturedBody = params.body;
return {
data: {
id: 12345,
html_url: "https://github.com/owner/repo/issues/42#issuecomment-12345",
},
};
};

const handler = await eval(`(async () => { ${addCommentScript}; return await main({}); })()`);

const message = {
type: "add_comment",
body: "Test comment body",
};

const result = await handler(message, {});

expect(result.success).toBe(true);
expect(capturedBody).toBeDefined();
expect(capturedBody).toContain("<!-- gh-aw-workflow-call-id: owner/repo/TestWorkflow -->");

delete process.env.GH_AW_WORKFLOW_NAME;
delete process.env.GH_AW_CALLER_WORKFLOW_ID;
});

it("should not include gh-aw-workflow-call-id marker when GH_AW_CALLER_WORKFLOW_ID is not set", async () => {
const addCommentScript = fs.readFileSync(path.join(__dirname, "add_comment.cjs"), "utf8");

process.env.GH_AW_WORKFLOW_NAME = "Test Workflow";
delete process.env.GH_AW_CALLER_WORKFLOW_ID;

let capturedBody = null;
mockGithub.rest.issues.createComment = async params => {
capturedBody = params.body;
return {
data: {
id: 12345,
html_url: "https://github.com/owner/repo/issues/42#issuecomment-12345",
},
};
};

const handler = await eval(`(async () => { ${addCommentScript}; return await main({}); })()`);

const message = {
type: "add_comment",
body: "Test comment body",
};

const result = await handler(message, {});

expect(result.success).toBe(true);
expect(capturedBody).toBeDefined();
expect(capturedBody).not.toContain("gh-aw-workflow-call-id");

delete process.env.GH_AW_WORKFLOW_NAME;
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These env var cleanups only run if the test reaches the end; if an assertion throws, GH_AW_WORKFLOW_NAME / GH_AW_CALLER_WORKFLOW_ID can leak into subsequent tests and cause cascading failures. Consider using try/finally around the env setup or moving env setup/teardown into beforeEach/afterEach for this describe block.

This issue also appears on line 1346 of the same file.

Suggested change
process.env.GH_AW_WORKFLOW_NAME = "Test Workflow";
process.env.GH_AW_CALLER_WORKFLOW_ID = "owner/repo/TestWorkflow";
let capturedBody = null;
mockGithub.rest.issues.createComment = async params => {
capturedBody = params.body;
return {
data: {
id: 12345,
html_url: "https://github.com/owner/repo/issues/42#issuecomment-12345",
},
};
};
const handler = await eval(`(async () => { ${addCommentScript}; return await main({}); })()`);
const message = {
type: "add_comment",
body: "Test comment body",
};
const result = await handler(message, {});
expect(result.success).toBe(true);
expect(capturedBody).toBeDefined();
expect(capturedBody).toContain("<!-- gh-aw-workflow-call-id: owner/repo/TestWorkflow -->");
delete process.env.GH_AW_WORKFLOW_NAME;
delete process.env.GH_AW_CALLER_WORKFLOW_ID;
});
it("should not include gh-aw-workflow-call-id marker when GH_AW_CALLER_WORKFLOW_ID is not set", async () => {
const addCommentScript = fs.readFileSync(path.join(__dirname, "add_comment.cjs"), "utf8");
process.env.GH_AW_WORKFLOW_NAME = "Test Workflow";
delete process.env.GH_AW_CALLER_WORKFLOW_ID;
let capturedBody = null;
mockGithub.rest.issues.createComment = async params => {
capturedBody = params.body;
return {
data: {
id: 12345,
html_url: "https://github.com/owner/repo/issues/42#issuecomment-12345",
},
};
};
const handler = await eval(`(async () => { ${addCommentScript}; return await main({}); })()`);
const message = {
type: "add_comment",
body: "Test comment body",
};
const result = await handler(message, {});
expect(result.success).toBe(true);
expect(capturedBody).toBeDefined();
expect(capturedBody).not.toContain("gh-aw-workflow-call-id");
delete process.env.GH_AW_WORKFLOW_NAME;
const previousWorkflowName = process.env.GH_AW_WORKFLOW_NAME;
const previousCallerWorkflowId = process.env.GH_AW_CALLER_WORKFLOW_ID;
try {
process.env.GH_AW_WORKFLOW_NAME = "Test Workflow";
process.env.GH_AW_CALLER_WORKFLOW_ID = "owner/repo/TestWorkflow";
let capturedBody = null;
mockGithub.rest.issues.createComment = async params => {
capturedBody = params.body;
return {
data: {
id: 12345,
html_url: "https://github.com/owner/repo/issues/42#issuecomment-12345",
},
};
};
const handler = await eval(`(async () => { ${addCommentScript}; return await main({}); })()`);
const message = {
type: "add_comment",
body: "Test comment body",
};
const result = await handler(message, {});
expect(result.success).toBe(true);
expect(capturedBody).toBeDefined();
expect(capturedBody).toContain("<!-- gh-aw-workflow-call-id: owner/repo/TestWorkflow -->");
} finally {
if (previousWorkflowName === undefined) {
delete process.env.GH_AW_WORKFLOW_NAME;
} else {
process.env.GH_AW_WORKFLOW_NAME = previousWorkflowName;
}
if (previousCallerWorkflowId === undefined) {
delete process.env.GH_AW_CALLER_WORKFLOW_ID;
} else {
process.env.GH_AW_CALLER_WORKFLOW_ID = previousCallerWorkflowId;
}
}
});
it("should not include gh-aw-workflow-call-id marker when GH_AW_CALLER_WORKFLOW_ID is not set", async () => {
const addCommentScript = fs.readFileSync(path.join(__dirname, "add_comment.cjs"), "utf8");
const previousWorkflowName = process.env.GH_AW_WORKFLOW_NAME;
const previousCallerWorkflowId = process.env.GH_AW_CALLER_WORKFLOW_ID;
try {
process.env.GH_AW_WORKFLOW_NAME = "Test Workflow";
delete process.env.GH_AW_CALLER_WORKFLOW_ID;
let capturedBody = null;
mockGithub.rest.issues.createComment = async params => {
capturedBody = params.body;
return {
data: {
id: 12345,
html_url: "https://github.com/owner/repo/issues/42#issuecomment-12345",
},
};
};
const handler = await eval(`(async () => { ${addCommentScript}; return await main({}); })()`);
const message = {
type: "add_comment",
body: "Test comment body",
};
const result = await handler(message, {});
expect(result.success).toBe(true);
expect(capturedBody).toBeDefined();
expect(capturedBody).not.toContain("gh-aw-workflow-call-id");
} finally {
if (previousWorkflowName === undefined) {
delete process.env.GH_AW_WORKFLOW_NAME;
} else {
process.env.GH_AW_WORKFLOW_NAME = previousWorkflowName;
}
if (previousCallerWorkflowId === undefined) {
delete process.env.GH_AW_CALLER_WORKFLOW_ID;
} else {
process.env.GH_AW_CALLER_WORKFLOW_ID = previousCallerWorkflowId;
}
}

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants