Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 28, 2026

✅ Complete: Add expires field support for create-pull-request safe-outputs

All requirements from the problem statement have been successfully implemented and tested.

Requirements Met

  • Expires field: Added support for expires on safe-outputs.create-pull-request
  • Behavior: Works the same as expires on create-issue and create-discussion
  • Default: false (no expiration) - only adds markers when explicitly configured
  • XML comment: Inserts <!-- gh-aw-expires: ISO_DATE --> when PR should expire
  • AI footer: Specifies expiration date in human-readable format
  • Maintenance job: Added step to scan open PRs and close expired ones
  • Closure comment: Adds explanatory comment with expiration date
  • XML type marker: Uses lowercase pull-request for searchability
  • Daily workflows: Configured daily automation workflows with 7-day expiration
  • Dev workflow: Updated to create PR with poem and 2h expiration for testing
  • Merged with main: Successfully merged latest main branch changes

Implementation Summary

Files Created:

  1. actions/setup/js/close_expired_pull_requests.cjs - Scans and closes expired PRs
  2. actions/setup/js/close_expired_pull_requests.test.cjs - Comprehensive test suite

Files Modified:

  1. pkg/workflow/maintenance_workflow.go - Added PR expiration tracking and step generation
  2. pkg/workflow/safe_outputs_config_generation.go - Pass expires to config generator
  3. pkg/workflow/safe_outputs_config_generation_helpers.go - Accept expires parameter
  4. actions/setup/js/create_pull_request.cjs - Use lowercase identifier in XML comment
  5. .github/workflows/agentics-maintenance.yml - Auto-regenerated with PR closure step
  6. .github/workflows/daily-doc-updater.md - Added expires: 7d
  7. .github/workflows/daily-workflow-updater.md - Added expires: 7d
  8. .github/workflows/dev.md - Added expires: 2h for poem PR testing

Merge Status:

  • Merged main branch successfully
  • Resolved conflict in dev.lock.yml (kept dev version)
  • All workflows recompiled cleanly

Existing Files (already had support):

  • actions/setup/js/create_pull_request.cjs - Already uses expiresHours and generateFooterWithExpiration
  • actions/setup/js/ephemerals.cjs - Provides extractExpirationDate for parsing

How to Use

In your workflow frontmatter:

safe-outputs:
  create-pull-request:
    expires: 24  # Hours (or 7d for days, 2w for weeks, 2h for hours)

Generated PR includes:

> AI generated by [Workflow Name](run-url)
> - [x] expires <!-- gh-aw-expires: 2026-01-29T19:00:00.000Z --> on Jan 29, 2026, 7:00 PM UTC

<!-- gh-aw-expires-type: pull-request -->

Automatic closure:

  • Agentics-maintenance workflow runs on schedule
  • Scans all open PRs for expiration markers
  • Closes expired PRs with comment: "This pull request was automatically closed because it expired on {date}."

Workflows with PR Expiration

Daily automation workflows (7d):

  • daily-doc-updater.md - Auto-updates documentation
  • daily-workflow-updater.md - Auto-updates GitHub Actions versions

Dev/testing workflow (2h):

  • dev.md - Creates PR with single line poem to poems.txt for testing expires feature

PRs created by these workflows will automatically expire and be closed after their configured time.

Testing

✅ JavaScript Tests (5/5 passing):

✓ should handle case when no pull requests with expiration markers exist
✓ should close an expired pull request
✓ should skip pull request that is not yet expired
✓ should handle errors when closing pull request
✓ should handle paginated results

✅ Config Generation Verified:

// 2 hours
{"create_pull_request":{"expires":2},...}

// 7 days
{"create_pull_request":{"expires":168},...}

✅ All Workflows Recompiled:

  • Successfully compiled 141 out of 141 workflow files
  • No errors or failures

✅ Format and Lint:

  • All files formatted successfully
  • All validations passed

Security Summary

No security vulnerabilities introduced:

  • Uses existing expiration infrastructure
  • Follows same patterns as issues and discussions
  • Proper input validation for expiration dates
  • Safe GraphQL queries and REST API calls
  • No additional permissions beyond pull-requests: write (already required)
Original prompt

Add support for an expires field on the safe-outputs.create pull-request configuration. This expires field should behave the same way as expires on create-issue or create-discussion. The default is false (no expiration), but this allows insertion of an XML comment indicating when the pull-request should expire.

The AI footer should specify the expiration date. Add a step in the agentic-maintenance job that scans open pull-requests, identifies those that are expired, and closes them with a comment stating that they have expired.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.


Changeset

  • Type: patch
  • Description: Add expires support to safe-outputs.create-pull-request so workflows can mark and auto-close expired pull requests.

Ahoy! This treasure was crafted by 🏴‍☠️ Changeset Generator

Copilot AI and others added 4 commits January 28, 2026 19:28
- Added close_expired_pull_requests.cjs script following same pattern as issues/discussions
- Updated maintenance_workflow.go to include pull requests in expires checking
- Added pull-requests: write permission to maintenance job
- Added step to close expired pull requests in maintenance workflow
- Updated documentation in maintenance workflow comments

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
- Created comprehensive test suite for close_expired_pull_requests.cjs
- Tests cover: no PRs found, expired PRs, not expired PRs, error handling, pagination
- All 5 tests passing
- Follows same testing pattern as close_expired_discussions

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
- Updated generatePullRequestConfig to include expires parameter
- Updated function call to pass CreatePullRequests.Expires
- Config now properly includes expires field in generated workflows
- Verified with test workflow compilation

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
All requirements implemented and tested:
- Expires field on create-pull-request configuration ✓
- XML comment marker for PR expiration ✓
- AI footer with expiration date ✓
- Maintenance job step to close expired PRs ✓
- Full test coverage ✓
- All workflows recompiled successfully ✓

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for expires field in safe-outputs.create config Add expires support for create-pull-request safe-outputs Jan 28, 2026
Copilot AI requested a review from pelikhan January 28, 2026 19:38
@pelikhan
Copy link
Contributor

@copilot use identifiers lowercase, no space in xml comments that need to be searchable. pull-request <!-- gh-aw-expires-type: Pull Request -->

@pelikhan
Copy link
Contributor

@copilot make "daily..." type of workflows expireable in 7d

Changed "Pull Request" to "pull-request" in XML comment for searchability as requested by @pelikhan

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

Copilot AI commented Jan 28, 2026

@copilot use identifiers lowercase, no space in xml comments that need to be searchable. pull-request <!-- gh-aw-expires-type: Pull Request -->

Changed to lowercase pull-request in commit 7c049e6.

Added expires: 7d to create-pull-request configurations in:
- daily-doc-updater.md
- daily-workflow-updater.md

This ensures PRs from daily automation workflows are automatically closed after 7 days if not merged.

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

Copilot AI commented Jan 28, 2026

@copilot make "daily..." type of workflows expireable in 7d

Added expires: 7d to both daily workflows that create PRs (daily-doc-updater and daily-workflow-updater) in commit 3d2e168. PRs from these workflows will now automatically expire and close after 7 days.

@pelikhan pelikhan added the smoke label Jan 28, 2026
@pelikhan pelikhan marked this pull request as ready for review January 28, 2026 20:32
@github-actions
Copy link
Contributor

github-actions bot commented Jan 28, 2026

✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟

@github-actions
Copy link
Contributor

github-actions bot commented Jan 28, 2026

🎉 Yo ho ho! Changeset Generator found the treasure and completed successfully! ⚓💰

@github-actions
Copy link
Contributor

github-actions bot commented Jan 28, 2026

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

@github-actions
Copy link
Contributor

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

@github-actions
Copy link
Contributor

Smoke Test Results

PRs Reviewed:

Test Status
GitHub MCP
Safe Inputs GH CLI
Serena MCP
Playwright
File Writing
Bash Tool
Discussion Interaction

Overall: PASS

@pelikhan @Copilot - All systems operational!

§21454439213

AI generated by Smoke Copilot

@github-actions
Copy link
Contributor

PRs:
chore: create parent issue for agent
Normalize report formatting guidelines for daily-team-evolution-insights workflow
Add canary_go job to detect untested Go functions
Apply console formatting to top 5 CLI error-heavy files
Tests: GitHub MCP ✅; safeinputs-gh ✅; Serena ✅; Playwright ✅; Tavily ✅; File write ✅; Bash cat ✅; Discussion ✅
Overall: PASS

AI generated by Smoke Codex

@github-actions
Copy link
Contributor

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

@pelikhan
Copy link
Contributor

@copilot update dev to create a pull request that adds a single line poem to "poems.txt" with a 2h expiration.

Modified dev.md workflow to:
- Add single line poem to poems.txt
- Create pull request with expires: 2h
- Set as draft PR with [dev] prefix
- Updated description and requirements

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

Copilot AI commented Jan 28, 2026

@copilot update dev to create a pull request that adds a single line poem to "poems.txt" with a 2h expiration.

Updated dev workflow to create a PR that adds a single line poem to poems.txt with expires: 2h in commit 0742fb5. The workflow now instructs the agent to create poems.txt and submit it as a draft PR that expires in 2 hours.

@pelikhan
Copy link
Contributor

@copilot merge main, keep dev, format, lint

Copilot AI and others added 2 commits January 28, 2026 23:49
- Merged main branch into feature branch
- Resolved merge conflict in dev.lock.yml by keeping dev version
- Ran make fmt - all files formatted successfully
- Ran make lint - all validations passed
- All 141 workflows recompiled successfully

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

Copilot AI commented Jan 28, 2026

@copilot merge main, keep dev, format, lint

Merged main branch and resolved conflicts (kept dev version) in commit ea386d6. Format and lint passed successfully - all files formatted and all validations passed.

@github-actions
Copy link
Contributor

✅ Dev Hawk Report - Success

Workflow: #3241

  • Status: ✅ success
  • Commit: 082d2ab

Dev workflow completed successfully! 🎉

Workflow Summary

All 5 jobs completed successfully:

  • activation - Setup and validation (8s)
  • agent - Copilot CLI execution (8m 6s)
  • detection - Threat detection analysis (28s)
  • safe_outputs - Safe outputs processing (12s)
  • conclusion - Workflow conclusion (11s)

Total run time: ~9m 22s

What This Means

The Dev workflow successfully executed after merging main into your PR branch. All agent tasks, threat detection, and safe output processing completed without errors. The PR is ready for review!

AI generated by Dev Hawk

@pelikhan pelikhan merged commit a6789e8 into main Jan 29, 2026
61 checks passed
@pelikhan pelikhan deleted the copilot/add-expires-field-to-pull-request branch January 29, 2026 00:18
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.

2 participants