feat: add ignore-bot-updates option - #1358
Open
neenhouse wants to merge 2 commits into
Open
Conversation
When enabled, activity caused by bot accounts (user type Bot) does not remove the stale label and does not block closing. Human activity behaves as usual: comments, label changes, and (for pull requests) pushed commits remove the stale label and restart the cycle. Motivation: in repositories with heavy automation (label syncs, preview deployments, generated comments), every bot touch bumps updated_at, removes the stale label, and restarts the full days-before-stale countdown - so the stale cycle never completes and PRs orbit the warning state indefinitely. Related: actions#795, actions#1309, actions#1243. Behavior details: - The un-stale check attributes updates via issue events: if every event since the stale marking was caused by a bot (or was the stale labeling itself), the update does not un-stale the item. - For pull requests, the last commit date is checked so a human push (which bumps updated_at without leaving an issue event) still counts as human activity. - An updated_at bump with no attributable cause (e.g. a body edit) is treated as human activity, keeping the item open - fail-safe direction. - The close-window check runs from the stale-marking date instead of updated_at, since bots keep updated_at perpetually fresh. - Default false; behavior is byte-identical when disabled (covered by a regression test mirroring the enabled-path fixture).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
Adds an
ignore-bot-updatesoption (defaultfalse). When enabled, activity caused by bot accounts (user typeBot) does not remove the stale label and does not block closing. Human activity behaves exactly as before: a comment, a label change, or (for pull requests) a pushed commit removes the stale label and restarts the cycle.Motivation. In repositories with heavy automation — label-sync workflows, preview deployments, generated sticky comments — every bot touch bumps
updated_at, removes the stale label, and restarts the fulldays-before-stalecountdown. The stale cycle never completes: items get warned, un-staled by a bot within a day or two, re-warned two weeks later, forever. In one repo we measured, ~100 PRs sat in this orbit while only a handful ever closed. The comment filter in_hasCommentsSincealready ignores bot comments, but theupdated_atcheck (issueHasUpdateSinceStale) and the close-window check both count bot activity, so bot-heavy repos can't converge.Behavior details:
hasOnlyStaleLabelingEventsSincelogic), the update does not un-stale the item.updated_atwithout leaving an issue event — still counts as human activity.updated_atbump with no attributable cause (e.g. a body edit, which leaves no issue event) is treated as human activity. The fail-safe direction is keeping items open.updated_at, since bots keepupdated_atperpetually fresh.IIssueEventgains an optionalactorfield (already present in the REST payload the action fetches; previously just untyped).Backward compatibility: with the option disabled (default), behavior is unchanged — the disabled path is covered by a regression test that mirrors the enabled-path fixture and asserts the old outcome.
Related issue:
Closes #1243 (option to exclude some update types from the last-update calculation); related: #795 (bot comment counted as regular update — the comment half was fixed, the
updated_athalf wasn't), #1309 (narrower fix: bot comments only; this PR also covers bot label/events churn and protects human pushes on PRs).Check list:
#### ignore-bot-updatessection)__tests__/ignore-bot-updates.spec.ts, 5 cases; full suite 1365 passing)