Skip to content

Commit a792c1a

Browse files
authored
Separate no-op run comments from failed runs issue (#14589)
1 parent da56490 commit a792c1a

2 files changed

Lines changed: 22 additions & 22 deletions

File tree

actions/setup/js/handle_noop_message.cjs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ const { renderTemplate } = require("./messages_core.cjs");
1212
*/
1313
async function ensureAgentRunsIssue() {
1414
const { owner, repo } = context.repo;
15-
const parentTitle = "[agentic-workflows] Agent runs";
15+
const parentTitle = "[agentic-workflows] No-Op Runs";
1616
const parentLabel = "agentic-workflows";
1717

18-
core.info(`Searching for agent runs issue: "${parentTitle}"`);
18+
core.info(`Searching for no-op runs issue: "${parentTitle}"`);
1919

20-
// Search for existing agent runs issue
20+
// Search for existing no-op runs issue
2121
const searchQuery = `repo:${owner}/${repo} is:issue is:open label:${parentLabel} in:title "${parentTitle}"`;
2222

2323
try {
@@ -28,19 +28,19 @@ async function ensureAgentRunsIssue() {
2828

2929
if (searchResult.data.total_count > 0) {
3030
const existingIssue = searchResult.data.items[0];
31-
core.info(`Found existing agent runs issue #${existingIssue.number}: ${existingIssue.html_url}`);
31+
core.info(`Found existing no-op runs issue #${existingIssue.number}: ${existingIssue.html_url}`);
3232

3333
return {
3434
number: existingIssue.number,
3535
node_id: existingIssue.node_id,
3636
};
3737
}
3838
} catch (error) {
39-
core.warning(`Error searching for agent runs issue: ${getErrorMessage(error)}`);
39+
core.warning(`Error searching for no-op runs issue: ${getErrorMessage(error)}`);
4040
}
4141

42-
// Create agent runs issue if it doesn't exist
43-
core.info(`No agent runs issue found, creating one`);
42+
// Create no-op runs issue if it doesn't exist
43+
core.info(`No no-op runs issue found, creating one`);
4444

4545
let parentBodyContent = `This issue tracks all no-op runs from agentic workflows in this repository. Each workflow run that completes with a no-op message (indicating no action was needed) posts a comment here.
4646
@@ -85,13 +85,13 @@ These are successful outcomes, not failures, and help provide transparency into
8585
labels: [parentLabel],
8686
});
8787

88-
core.info(`✓ Created agent runs issue #${newIssue.data.number}: ${newIssue.data.html_url}`);
88+
core.info(`✓ Created no-op runs issue #${newIssue.data.number}: ${newIssue.data.html_url}`);
8989
return {
9090
number: newIssue.data.number,
9191
node_id: newIssue.data.node_id,
9292
};
9393
} catch (error) {
94-
core.error(`Failed to create agent runs issue: ${getErrorMessage(error)}`);
94+
core.error(`Failed to create no-op runs issue: ${getErrorMessage(error)}`);
9595
throw error;
9696
}
9797
}
@@ -143,16 +143,16 @@ async function main() {
143143
return;
144144
}
145145

146-
core.info("Agent succeeded with only noop outputs - posting to agent runs issue");
146+
core.info("Agent succeeded with only noop outputs - posting to no-op runs issue");
147147

148148
const { owner, repo } = context.repo;
149149

150-
// Ensure agent runs issue exists
151-
let agentRunsIssue;
150+
// Ensure no-op runs issue exists
151+
let noopRunsIssue;
152152
try {
153-
agentRunsIssue = await ensureAgentRunsIssue();
153+
noopRunsIssue = await ensureAgentRunsIssue();
154154
} catch (error) {
155-
core.warning(`Could not create agent runs issue: ${getErrorMessage(error)}`);
155+
core.warning(`Could not create no-op runs issue: ${getErrorMessage(error)}`);
156156
// Don't fail the workflow if we can't create the issue
157157
return;
158158
}
@@ -186,13 +186,13 @@ ${sanitizeContent(noopMessage)}
186186
await github.rest.issues.createComment({
187187
owner,
188188
repo,
189-
issue_number: agentRunsIssue.number,
189+
issue_number: noopRunsIssue.number,
190190
body: fullCommentBody,
191191
});
192192

193-
core.info(`✓ Posted no-op message to agent runs issue #${agentRunsIssue.number}`);
193+
core.info(`✓ Posted no-op message to no-op runs issue #${noopRunsIssue.number}`);
194194
} catch (error) {
195-
core.warning(`Failed to post comment to agent runs issue: ${getErrorMessage(error)}`);
195+
core.warning(`Failed to post comment to no-op runs issue: ${getErrorMessage(error)}`);
196196
// Don't fail the workflow
197197
}
198198
} catch (error) {

actions/setup/js/handle_noop_message.test.cjs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ describe("handle_noop_message", () => {
117117
expect(mockGithub.rest.search.issuesAndPullRequests).not.toHaveBeenCalled();
118118
});
119119

120-
it("should create agent runs issue if it doesn't exist", async () => {
120+
it("should create no-op runs issue if it doesn't exist", async () => {
121121
process.env.GH_AW_WORKFLOW_NAME = "Test Workflow";
122122
process.env.GH_AW_RUN_URL = "https://github.com/test-owner/test-repo/actions/runs/123456";
123123
process.env.GH_AW_NOOP_MESSAGE = "No updates needed";
@@ -163,13 +163,13 @@ describe("handle_noop_message", () => {
163163

164164
// Verify search was performed
165165
expect(mockGithub.rest.search.issuesAndPullRequests).toHaveBeenCalledWith({
166-
q: expect.stringContaining("[agentic-workflows] Agent runs"),
166+
q: expect.stringContaining("[agentic-workflows] No-Op Runs"),
167167
per_page: 1,
168168
});
169169

170170
// Verify issue was created with correct title
171171
const createCall = mockGithub.rest.issues.create.mock.calls[0][0];
172-
expect(createCall.title).toBe("[agentic-workflows] Agent runs");
172+
expect(createCall.title).toBe("[agentic-workflows] No-Op Runs");
173173
expect(createCall.labels).toContain("agentic-workflows");
174174
expect(createCall.body).toContain("tracks all no-op runs");
175175

@@ -181,7 +181,7 @@ describe("handle_noop_message", () => {
181181
expect(commentCall.body).toContain("123456");
182182
});
183183

184-
it("should use existing agent runs issue if it exists", async () => {
184+
it("should use existing no-op runs issue if it exists", async () => {
185185
process.env.GH_AW_WORKFLOW_NAME = "Another Workflow";
186186
process.env.GH_AW_RUN_URL = "https://github.com/test-owner/test-repo/actions/runs/789";
187187
process.env.GH_AW_NOOP_MESSAGE = "Everything is up to date";
@@ -294,7 +294,7 @@ describe("handle_noop_message", () => {
294294
await main();
295295

296296
// Verify warning was logged but workflow didn't fail
297-
expect(mockCore.warning).toHaveBeenCalledWith(expect.stringContaining("Could not create agent runs issue"));
297+
expect(mockCore.warning).toHaveBeenCalledWith(expect.stringContaining("Could not create no-op runs issue"));
298298
});
299299

300300
it("should extract run ID from URL correctly", async () => {

0 commit comments

Comments
 (0)