Skip to content

remove-stale-when-updated not honoured in unmarking logic  #715

@0x5c

Description

@0x5c

Describe your issue

When remove-stale-when-updated is enabled (default or not), the logic for unmarking PR/issues does not unmark those that have been updated in other ways than comments. This causes a PR marked as stale to stay marked despite having received a review since being marked.

From the logs, we can tell that the action properly detects the new activity (and the correct time it happened), but still decides that the label should not be removed

Your stale action configuration

---
name: Stale Cleanup

on:
  workflow_dispatch:
  schedule:
    - cron: '30 1 * * *'

jobs:
  stale:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/stale@v4
        with:
          stale-issue-message: 'Issues become stale 90 days after last activity and are closed 14 days after that.  If this issue is still relevant bump it or assign it.'
          stale-pr-message: 'Pull Requests become stale 90 days after last activity and are closed 14 days after that.  If this pull request is still relevant bump it or assign it.'
          days-before-stale: 90
          days-before-close: 14
          exempt-all-assignees: true
          ascending: true
          operations-per-run: 250
          exempt-issue-labels: request

Further context

Log segment for that PR
  [#34884] Pull request #34884
  [#34884] Found this pull request last updated at: 2022-04-10T11:45:44Z
  [#34884] The option only-labels (​https://github.com/actions/stale#only-labels​) was not specified
  [#34884] └── Continuing the process for this pull request
  [#34884] Days before pull request stale: 90
  [#34884] The pull request is not closed nor locked. Trying to remove the close label...
  [#34884] ├── The close-pr-label (​https://github.com/actions/stale#close-pr-label​) option was not set
  [#34884] └── Skipping the removal of the close label
  [#34884] This pull request has a stale label
  [#34884] The option any-of-labels (​https://github.com/actions/stale#any-of-labels​) was not specified
  [#34884] └── Continuing the process for this pull request
  [#34884] This pull request has no milestone
  [#34884] └── Skip the milestones checks
  [#34884] This pull request has no assignee
  [#34884] └── Skip the assignees checks
  [#34884] This pull request is already stale
  [#34884] Checking for label on this pull request
  [#34884] Pull request marked stale on: 2022-04-10T02:05:37Z
  [#34884] Checking for comments on pull request since: 2022-04-10T02:05:37Z
  [#34884] Comments that are not the stale comment or another bot: 0
  [#34884] Pull request has been commented on: false
  [#34884] Days before pull request close: 14
  [#34884] Pull request has been updated: true
  [#34884] The option remove-stale-when-updated (​https://github.com/actions/stale#remove-stale-when-updated​) is: true
  [#34884] The stale label should not be removed
  [#34884] Stale pull request is not old enough to close yet (hasComments? false, hasUpdate? true)
  [#34884] 1 operation consumed for this pull request

The readme for both v4 and v5 states that when remove-stale-when-updated is true, issue/PRs that have been updated should be unmarked, based on the value of updated_at.

In issues-processor.ts, issueHasUpdate is only used in the issue closing logic at

if (!issueHasComments && !issueHasUpdate) {
while the unmarking logic at
// Should we un-stale this issue?
if (shouldRemoveStaleWhenUpdated && issueHasComments) {
only checks for the setting (remove-stale-when-updated and issue/PR variants) AND presence of new comments.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions