-
Notifications
You must be signed in to change notification settings - Fork 318
Add scheduled workflow to clean up stale PR status checks #6224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: mazhelez <43066499+mazhelez@users.noreply.github.com>
Co-authored-by: mazhelez <43066499+mazhelez@users.noreply.github.com>
Co-authored-by: mazhelez <43066499+mazhelez@users.noreply.github.com>
Co-authored-by: mazhelez <43066499+mazhelez@users.noreply.github.com>
Co-authored-by: mazhelez <43066499+mazhelez@users.noreply.github.com>
Co-authored-by: mazhelez <43066499+mazhelez@users.noreply.github.com>
Co-authored-by: mazhelez <43066499+mazhelez@users.noreply.github.com>
Co-authored-by: mazhelez <43066499+mazhelez@users.noreply.github.com>
Co-authored-by: mazhelez <43066499+mazhelez@users.noreply.github.com>
Co-authored-by: mazhelez <43066499+mazhelez@users.noreply.github.com>
Updated the comment body for stale PR status checks to provide clearer instructions and reasoning for deletion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: mazhelez <43066499+mazhelez@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Could not find a linked ADO work item. Please link one by using the pattern 'AB#' followed by the relevant work item number. You may use the 'Fixes' keyword to automatically resolve the work item when the pull request is merged. E.g. 'Fixes AB#1234' |
Adds automation to keep PR status checks fresh by deleting stale checks and prompting PR authors to trigger new ones. This ensures status checks run on the current codebase state rather than outdated merge commits.
Implementation
0 0 */3 * *(every 3 days at midnight UTC)workflow_dispatch.github/workflows/CleanUpStalePRChecks.yaml.github/actions/CleanUpStalePRChecks/Logic
gh pr listand filter to MERGEABLE state onlygh pr checks(usingstatefield)state: SUCCESS) andcompletedAt > 72h:gh run deleteWhy Delete Instead of Rerun?
Rerunning a workflow run would still use the old merge commit, not reflecting the current codebase state. Deleting the run puts the PR in a "waiting for status checks" state, and the next commit or close/reopen will trigger a fresh check on the current merge commit.
Key Details
InvariantCulturefor locale safetyInvoke-CommandWithRetryfrom EnlistmentHelperFunctions.psm1 with exponential backoffGITHUB_STEP_SUMMARYfor better visibilityPermissions Required
💡 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.