Skip to content

Commit a6789e8

Browse files
Copilotpelikhangithub-actions[bot]
authored
Add expires support for create-pull-request safe-outputs (#12344)
* Initial plan * Add expires field support for pull-request safe-outputs - 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> * Add tests for close_expired_pull_requests - 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> * Add expires field to pull request safe-outputs config generation - 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> * Complete: Add expires field support for pull-request safe-outputs 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> * Use lowercase identifier in gh-aw-expires-type XML comment 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> * Add 7d expires to daily workflows with create-pull-request 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> * Add changeset [skip-ci] * Update dev workflow to create PR with poem and 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> * Merge main, format, and lint - 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> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Peli de Halleux <pelikhan@users.noreply.github.com>
1 parent 29877dc commit a6789e8

17 files changed

+1389
-28
lines changed

.changeset/patch-add-pr-expires.md

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/agentics-maintenance.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
# ./gh-aw compile --validate --verbose
2727
#
2828
# The workflow is generated when any workflow uses the 'expires' field
29-
# in create-discussions or create-issues safe-outputs configuration.
29+
# in create-discussions, create-issues, or create-pull-request safe-outputs configuration.
3030
# Schedule frequency is automatically determined by the shortest expiration time.
3131
#
3232
name: Agentic Maintenance
@@ -44,6 +44,7 @@ jobs:
4444
permissions:
4545
discussions: write
4646
issues: write
47+
pull-requests: write
4748
steps:
4849
- name: Checkout actions folder
4950
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
@@ -75,6 +76,15 @@ jobs:
7576
const { main } = require('/opt/gh-aw/actions/close_expired_issues.cjs');
7677
await main();
7778
79+
- name: Close expired pull requests
80+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
81+
with:
82+
script: |
83+
const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs');
84+
setupGlobals(core, github, context, exec, io);
85+
const { main } = require('/opt/gh-aw/actions/close_expired_pull_requests.cjs');
86+
await main();
87+
7888
compile-workflows:
7989
runs-on: ubuntu-slim
8090
permissions:

.github/workflows/ci-coach.lock.yml

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/code-simplifier.lock.yml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/daily-doc-updater.lock.yml

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/daily-doc-updater.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ network:
2323

2424
safe-outputs:
2525
create-pull-request:
26+
expires: 7d
2627
title-prefix: "[docs] "
2728
labels: [documentation, automation]
2829
reviewers: [copilot]

.github/workflows/daily-workflow-updater.lock.yml

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/daily-workflow-updater.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ network:
2323

2424
safe-outputs:
2525
create-pull-request:
26+
expires: 7d
2627
title-prefix: "[actions] "
2728
labels: [dependencies, automation]
2829
draft: false

0 commit comments

Comments
 (0)