Skip to content

feat: add ignore-bot-updates option - #1358

Open
neenhouse wants to merge 2 commits into
actions:mainfrom
neenhouse:ignore-bot-updates
Open

feat: add ignore-bot-updates option#1358
neenhouse wants to merge 2 commits into
actions:mainfrom
neenhouse:ignore-bot-updates

Conversation

@neenhouse

Copy link
Copy Markdown

Description:

Adds an ignore-bot-updates option (default false). When enabled, activity caused by bot accounts (user type Bot) 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 full days-before-stale countdown. 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 _hasCommentsSince already ignores bot comments, but the updated_at check (issueHasUpdateSinceStale) and the close-window check both count bot activity, so bot-heavy repos can't converge.

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 — extending the existing hasOnlyStaleLabelingEventsSince logic), 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, which leaves no issue event) is treated as human activity. The fail-safe direction is keeping items open.
  • The close-window check runs from the stale-marking date instead of updated_at, since bots keep updated_at perpetually fresh.
  • IIssueEvent gains an optional actor field (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_at half wasn't), #1309 (narrower fix: bot comments only; this PR also covers bot label/events churn and protects human pushes on PRs).

Check list:

  • Mark if documentation changes are required. (README: options table row + #### ignore-bot-updates section)
  • Mark if tests were added or updated to cover the changes. (__tests__/ignore-bot-updates.spec.ts, 5 cases; full suite 1365 passing)

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).
@neenhouse
neenhouse requested a review from a team as a code owner August 4, 2026 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add ability to exclude some types of updates from calculation of last update time

1 participant