Conversation
…orts Add `idempotent: true` option to the `create-issue` safe-output handler. When enabled, the handler searches for an existing open issue created today (UTC) with the same workflow-id or close-older-key marker before creating a new one. If found, creation is silently skipped and the max-count slot is not consumed. This prevents same-day duplicate issues from occurring when a scheduled workflow (like contribution-check) runs multiple times per day. Also enable `idempotent: true` in contribution-check.md workflow to fix the duplicate report issue described in the issue. Changes: - pkg/workflow/create_issue.go: add Idempotent field to CreateIssuesConfig - pkg/workflow/compiler_safe_outputs_config.go: wire idempotent to handler config - pkg/parser/schemas/main_workflow_schema.json: add idempotent to schema - actions/setup/js/create_issue.cjs: implement dedupe-before-create logic - actions/setup/js/close_older_issues.cjs: expose created_at in search results - actions/setup/js/create_issue.test.cjs: add 6 tests for idempotent mode - .github/workflows/contribution-check.md: enable idempotent: true - docs: document new idempotent option in safe-outputs and frontmatter-full Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> Agent-Logs-Url: https://github.com/github/gh-aw/sessions/081eb637-d376-4a2e-8ac0-e58c24da8a84
create-issue to prevent same-day duplicate reports
|
@copilot rename the new feature group by day. If a previous issue exists, post the new content as a comment on the existing issue instead of creating a new issue. |
|
Hey This PR is well-structured, focused, and thoroughly tested — the 6 new JS test cases in The PR looks ready for maintainer review. 🎉
|
Per feedback, rename the `idempotent` feature to `group-by-day` and change
the behavior: instead of skipping issue creation when a same-day issue is
found, post the new content as a comment on the existing issue so all
same-day runs are grouped in one place.
- Rename config key: idempotent -> group-by-day (Go, JS, schema, docs)
- Change behavior: post body as comment on existing today-issue
- Return { grouped: true, existingIssueNumber, commentUrl } on grouping
- Update contribution-check.md to use group-by-day: true
- Update tests and documentation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/45df665e-9d93-459c-8451-8aec175aba33
Done in 4911a61. Renamed Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
create-issue to prevent same-day duplicate reportsgroup-by-day for create-issue to prevent same-day duplicate reports
There was a problem hiding this comment.
Pull request overview
Adds a group-by-day option to the create-issue safe-output handler to avoid creating/closing duplicate report issues when scheduled workflows run multiple times in the same day, by commenting onto an existing same-day issue instead.
Changes:
- Implement
group-by-daypre-check in the JScreate_issuehandler to comment on an existing same-day open issue instead of creating a new one. - Wire the new option through the Go compiler/config + JSON schema, and enable it for the
contribution-checkworkflow (including lockfile regen). - Add JS tests and documentation describing the new behavior.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/workflow/create_issue.go | Adds group-by-day to the create-issue YAML config and bool preprocessing. |
| pkg/workflow/compiler_safe_outputs_config.go | Passes group_by_day through to the JS handler config. |
| pkg/parser/schemas/main_workflow_schema.json | Adds group-by-day to the create-issue schema. |
| actions/setup/js/create_issue.cjs | Implements same-day dedupe via search + comment fallback. |
| actions/setup/js/close_older_issues.cjs | Exposes created_at in searchOlderIssues results to support day comparison. |
| actions/setup/js/create_issue.test.cjs | Adds test coverage for group-by-day scenarios. |
| docs/src/content/docs/reference/safe-outputs.md | Documents group-by-day and behavior details. |
| docs/src/content/docs/reference/frontmatter-full.md | Adds group-by-day to the full reference example/config docs. |
| .github/workflows/contribution-check.md | Enables group-by-day: true for the contribution check report. |
| .github/workflows/contribution-check.lock.yml | Regenerates compiled lock config including group_by_day. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| .map(item => ({ | ||
| number: item.number, | ||
| title: item.title, | ||
| html_url: item.html_url, | ||
| labels: item.labels || [], | ||
| created_at: item.created_at, | ||
| })); |
There was a problem hiding this comment.
searchOlderIssues now includes created_at in its returned objects, but the function’s JSDoc return type still describes only {number,title,html_url,labels}. Update the documented return shape to include created_at so downstream callers (like group-by-day) are accurately reflected in typings/docs.
| const existingIssues = await searchOlderIssues( | ||
| github, | ||
| repoParts.owner, | ||
| repoParts.repo, | ||
| workflowId, | ||
| 0, // no issue to exclude — this is a pre-creation check | ||
| callerWorkflowId, | ||
| closeOlderKey | ||
| ); | ||
| const todayIssue = existingIssues.find(issue => { | ||
| const createdDate = issue.created_at ? String(issue.created_at).split("T")[0] : ""; | ||
| return createdDate === today; | ||
| }); | ||
| if (todayIssue) { | ||
| core.info(`Group-by-day: found open issue #${todayIssue.number} created today (${today}) — posting new content as a comment`); | ||
| const comment = await addIssueComment(github, repoParts.owner, repoParts.repo, todayIssue.number, body); | ||
| core.info(`Posted content as comment ${comment.html_url} on issue #${todayIssue.number}`); |
There was a problem hiding this comment.
Group-by-day uses the global github client for searchOlderIssues/addIssueComment, but the handler otherwise creates an authenticated githubClient (which may use a per-handler github-token for cross-repo operations). This can cause the pre-check/comment to run with the wrong token and fail or operate on the wrong permissions. Use githubClient consistently for the search and comment API calls here (and for any other GitHub API calls in this handler) so authentication matches the target repo configuration.
| // Group-by-day check: if enabled, search for an existing open issue created today. | ||
| // When found, post the new content as a comment on the existing issue instead of | ||
| // creating a duplicate. This groups multiple same-day runs into a single issue. | ||
| // NOTE: processedCount was already incremented above. If we post as a comment, we undo | ||
| // the increment here so the max-count slot is not consumed. | ||
| if (groupByDayEnabled && (closeOlderKey || workflowId)) { | ||
| const today = new Date().toISOString().split("T")[0]; // YYYY-MM-DD (UTC) |
There was a problem hiding this comment.
The max-count guard runs before the group-by-day pre-check. If processedCount >= maxCount (e.g., max: 1 and one issue was already created earlier in the same run), the handler returns early and never attempts group-by-day, even though grouping is intended not to consume a max slot. Consider moving the group-by-day lookup before the max-count check/increment, or only increment/apply max when an issue is actually created (not when grouping as a comment).
|
@copilot review comments |
|
@copilot fix tests CI / js (pull_request)Failing after 20s |
- Update searchOlderIssues JSDoc @returns to include created_at field - Use githubClient (not global github) for searchOlderIssues and addIssueComment so custom github-token config is respected for cross-repo operations - Move processedCount++ after group-by-day check so max-count slots are never consumed for grouped-as-comment paths (removes the processedCount-- hack) Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> Agent-Logs-Url: https://github.com/github/gh-aw/sessions/853fae40-1f00-4e50-bbb7-5decaeea89c9
Addressed all three review comments in 877520a:
|
The CI failures were TypeScript type errors ( Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Scheduled workflows running multiple times per day (e.g.
contribution-checkevery 4 hours) produce duplicate same-day report issues — the second run creates a new issue and closes the first, leaving two same-date issues in history.Changes
New
group-by-dayoption forcreate-issueBefore creating an issue, searches for an existing open issue with the same workflow-id marker (or
close-older-keyif configured) created today (UTC). If found, posts the new content as a comment on the existing issue instead of creating a new one. Falls back to normal creation if the pre-check fails.Infrastructure
create_issue.cjs— group-by-day logic usingsearchOlderIssues+addIssueComment; warns at init if neitherclose-older-keynorGH_AW_WORKFLOW_IDis setclose_older_issues.cjs— exposescreated_atinsearchOlderIssuesreturn value (needed for date comparison)create_issue.go,compiler_safe_outputs_config.go) — newGroupByDay *stringfield wired through to handler configgroup-by-dayadded tocreate-issueschema propertiesWorkflow
contribution-check.md—group-by-day: trueenabled; lock file recompiledTests & Docs
safe-outputs.mdandfrontmatter-full.mdupdated with new option documentation📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.