Skip to content

Use workflow-id markers for close-older-discussions#13914

Merged
pelikhan merged 4 commits intomainfrom
copilot/use-xml-comments-for-markers
Feb 5, 2026
Merged

Use workflow-id markers for close-older-discussions#13914
pelikhan merged 4 commits intomainfrom
copilot/use-xml-comments-for-markers

Conversation

Copy link
Contributor

Copilot AI commented Feb 5, 2026

The close-older-discussions feature searched by title-prefix or labels. This was inconsistent with close-older-issues, which searches by workflow-id XML markers embedded in the body.

Changes

  • close_older_discussions.cjs: Changed search from title-prefix/labels to workflow-id marker

    • Updated searchOlderDiscussions() signature: (github, owner, repo, workflowId, categoryId, excludeNumber)
    • Now searches for gh-aw-workflow-id: <id> in discussion body using GitHub search API
    • Removed all title-prefix and label filtering logic
  • Tests: Updated to use workflow-id instead of title-prefix/labels patterns

  • Documentation: Removed title-prefix/labels requirements and examples

Before/After

// Before - required title-prefix or labels
closeOlderDiscussions(github, owner, repo, "[weekly-report]", ["automation"], categoryId, ...)

// After - uses workflow-id marker (consistent with issues)
closeOlderDiscussions(github, owner, repo, "daily-status", categoryId, ...)

Both issues and discussions now use the same marker-based resolution mechanism.

Original prompt

close-older-issue/discussion JavaScript resolution code should only use xml comment based markers.

Ignore labels and title-prefix


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits February 5, 2026 13:38
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Update resolution code to use XML comment markers Use workflow-id markers for close-older-discussions Feb 5, 2026
Copilot AI requested a review from pelikhan February 5, 2026 13:52
@pelikhan pelikhan marked this pull request as ready for review February 5, 2026 13:54
Copilot AI review requested due to automatic review settings February 5, 2026 13:54
@pelikhan pelikhan merged commit db31a3f into main Feb 5, 2026
159 of 160 checks passed
@pelikhan pelikhan deleted the copilot/use-xml-comments-for-markers branch February 5, 2026 13:54
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

This PR updates the close-older-discussions feature to use workflow-id XML markers for identifying discussions to close, making it consistent with the close-older-issues feature. The changes remove the previous title-prefix and label-based matching logic in favor of searching for discussions containing a gh-aw-workflow-id: <id> marker in their body.

Changes:

  • Refactored searchOlderDiscussions() to search by workflow-id marker instead of title-prefix/labels
  • Updated all tests to reflect the new workflow-id based approach
  • Updated documentation to remove title-prefix/labels requirements and describe the workflow-id marker approach

Reviewed changes

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

File Description
actions/setup/js/close_older_discussions.cjs Refactored search logic to use workflow-id markers; added comprehensive logging; removed title-prefix and label filtering
actions/setup/js/close_older_discussions.test.cjs Updated tests to use workflow-id parameters; removed tests for title-prefix and label matching
docs/src/content/docs/reference/frontmatter-full.md Updated documentation to describe workflow-id marker-based approach instead of title-prefix/labels
docs/src/content/docs/guides/ephemerals.md Updated guide examples and requirements to reflect workflow-id marker approach

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

const workflowIdMarker = getWorkflowIdMarkerContent(workflowId);
// Escape quotes in workflow ID to prevent query injection
const escapedMarker = workflowIdMarker.replace(/"/g, '\\"');
let searchQuery = `repo:${owner}/${repo} is:open "${escapedMarker}" in:body`;
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

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

The search query construction is missing the discussion type filter. For consistency with the issues query (which uses is:issue) and to ensure only discussions are returned, the query should include an explicit type filter.

Compare with close_older_issues.cjs:50 which uses:
repo:${owner}/${repo} is:issue is:open "${escapedMarker}" in:body

This query should be:
repo:${owner}/${repo} is:open is:discussion "${escapedMarker}" in:body

or

repo:${owner}/${repo} is:discussion is:open "${escapedMarker}" in:body

Without the is:discussion filter, the GitHub search API might return other entity types, though the GraphQL query's type: DISCUSSION parameter should filter to discussions. However, having consistency in the search query string itself is clearer and follows the pattern used for issues.

Suggested change
let searchQuery = `repo:${owner}/${repo} is:open "${escapedMarker}" in:body`;
let searchQuery = `repo:${owner}/${repo} is:open is:discussion "${escapedMarker}" in:body`;

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants