Conversation
|
Note This PR is from a fork and modifies infrastructure files ( Changes to infrastructure typically need to be submitted from a branch in Please consider recreating this PR from an upstream branch. If you don't have push access to |
There was a problem hiding this comment.
Pull request overview
Adds a new GitHub Agentic Workflow (gh-aw) to automatically warn on and close stale pull requests based on inactivity thresholds, supporting ongoing repository maintenance.
Changes:
- Introduces a
close-stale-prsagent prompt defining stale PR policy, exclusions, and action templates. - Adds the compiled
*.agent.lock.ymlworkflow generated bygh aw compileto run on a weekly schedule and execute safe outputs (comment/close PR).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| .github/workflows/close-stale-prs.agent.md | Defines the stale-PR detection policy and instructions for warning/closing PRs via safe-output tools. |
| .github/workflows/close-stale-prs.agent.lock.yml | Compiled gh-aw workflow that runs the agent on a schedule and enables add_comment / close_pull_request safe outputs. |
Comments suppressed due to low confidence (2)
.github/workflows/close-stale-prs.agent.md:26
- The "last non-bot activity" definition only considers comments and reviews. This will incorrectly treat PRs with recent pushes/commits (but no discussion) as inactive and may warn/close actively updated PRs. Consider including commit activity (e.g., latest commit/push timestamp) and/or other relevant PR timeline events in the activity calculation, while still ignoring the bot’s own stale-warning comment updates.
- **Last activity date**: The date of the most recent **non-bot** activity on the pull request. To determine this, list the PR's comments and reviews and find the most recent one **not** authored by a bot (i.e., ignore comments from users whose login ends with `[bot]`). If there are no non-bot comments or reviews, fall back to the PR's `created_at` date. Do **not** rely on `updated_at` alone, because the bot's own stale-warning comment updates `updated_at` and would reset the inactivity timer.
- **Stale (warning)**: A PR is eligible for a stale warning if it was created more than 30 days ago **and** its last non-bot activity was more than 30 days ago but no more than 37 days ago (i.e., 30 < days_since_last_non_bot_activity ≤ 37), **and** the PR does not already have a stale warning comment from this bot.
.github/workflows/close-stale-prs.agent.md:36
- The workflow defines bots as accounts whose login ends with
[bot], but later treatsdotnet-maestro(no[bot]suffix) as a bot for author-skipping. With the current definition,dotnet-maestrocomments/reviews on other PRs would be treated as “non-bot activity” and could prevent staleness actions. Consider expanding the bot filter to also treat known service accounts likedotnet-maestroas bots when computing last activity.
b. Skip it if it was authored by `dotnet-maestro[bot]` or `dotnet-maestro` — dependency update PRs are managed separately.
c. Skip it if it was created **fewer than 30 days ago**.
d. Determine the **last non-bot activity date**: fetch the PR's comments and reviews, find the most recent entry not authored by a bot (login ending in `[bot]`), and use its date. If none exist, use the PR's `created_at` date.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Skip scheduled runs on forked repositories to avoid consuming fork owner minutes and failing due to missing secrets/context, matching the pattern used by other scheduled workflows in this repo. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
| @@ -0,0 +1,67 @@ | |||
| --- | |||
| name: "Close Stale Pull Requests" | |||
There was a problem hiding this comment.
Consider: Any chance these could be scripts instead? Doesn't seem like we'd need a model to process most of this. Perhaps this agent could invoke the script as well if we'd prefer.
There was a problem hiding this comment.
This could definitely be a normal gh actions workflow but the cost of running this as a gh agentic workflow is extremely low (it only runs weekly and the copilot session doesn't take any longer than 2-3 minutes).
I prefer an agentic workflow as it gives us more flexibility if we would ever want to add reasoning or other non-deterministic behaviors.
Summary
Adds a GitHub Agentic Workflow that automatically manages stale pull requests by warning authors and eventually closing inactive PRs.
Policy
no-staleare exempt.dotnet-maestro[bot]/dotnet-maestroare skipped (managed separately).Schedule
Runs weekly on Monday via
scheduletrigger, withworkflow_dispatchfor manual runs. Includes a fork-guard to skip scheduled runs on forked repositories.Safe outputs
close_pull_requestadd_commentFiles
.github/workflows/close-stale-prs.agent.md— Agent prompt defining the stale PR policy and instructions..github/workflows/close-stale-prs.agent.lock.yml— Compiled workflow (auto-generated bygh aw compile).