Skip to content
This repository has been archived by the owner on May 20, 2023. It is now read-only.

[Feature request] Do not include stale label while getting stale issues #225

Closed
trivikr opened this issue Jul 29, 2019 · 6 comments
Closed

Comments

@trivikr
Copy link

trivikr commented Jul 29, 2019

Hi,

We're discussing using stale bot in Node.js core repository in nodejs/node#28798

While going through your code, I noticed that the function mark calls getStale for getting stale issues

const staleItems = (await this.getStale(type)).data.items

The function getStale doesn't exclude already stale issues

stale/lib/stale.js

Lines 72 to 73 in e3c53eb

const labels = [staleLabel].concat(exemptLabels)
const queryParts = labels.map(label => `-label:"${label}"`)

The function markIssue marks stale issues as stale

stale/lib/stale.js

Lines 115 to 136 in e3c53eb

async markIssue (type, issue) {
if (this.remainingActions === 0) {
return
}
this.remainingActions--
const { owner, repo } = this.config
const perform = this.getConfigValue(type, 'perform')
const staleLabel = this.getConfigValue(type, 'staleLabel')
const markComment = this.getConfigValue(type, 'markComment')
const number = issue.number
if (perform) {
this.logger.info('%s/%s#%d is being marked', owner, repo, number)
if (markComment) {
await this.github.issues.createComment({ owner, repo, number, body: markComment })
}
return this.github.issues.addLabels({ owner, repo, number, labels: [staleLabel] })
} else {
this.logger.info('%s/%s#%d would have been marked (dry-run)', owner, repo, number)
}
}

Feature Requests:

  1. Do not include staleLabel while searching for stale issues
  2. Do not add staleLabel if already present while commenting on stale issues
  3. Exclude comment activity from stale bot while unmarking updated issues

    stale/index.js

    Lines 41 to 43 in e3c53eb

    if (stale.hasStaleLabel(type, issue) && issue.state !== 'closed' && !staleLabelAdded) {
    stale.unmarkIssue(type, issue)
    }
  4. While searching for closableItems in sweep, instead of searching for days since last activity of more than daysUntilClose, search for staleLabel marked for more than daysUntilClose

    stale/lib/stale.js

    Lines 49 to 63 in e3c53eb

    async sweep (type) {
    const { owner, repo } = this.config
    const daysUntilClose = this.getConfigValue(type, 'daysUntilClose')
    if (daysUntilClose) {
    this.logger.trace({ owner, repo }, 'Configured to close stale issues')
    const closableItems = (await this.getClosable(type)).data.items
    await Promise.all(closableItems.filter(issue => !issue.locked).map(issue => {
    this.close(type, issue)
    }))
    } else {
    this.logger.trace({ owner, repo }, 'Configured to leave stale issues open')
    }
    }
  5. Any other impact this change might have.

This will be helpful in projects where daysUntilClose > daysUntilStale
The stale bot will continue commenting every daysUntilStale of activity, and close issues after daysUntilClose

Regards,
Trivikram

@issue-label-bot
Copy link

Issue-Label Bot is automatically applying the label feature_request to this issue, with a confidence of 0.78. Please mark this comment with 👍 or 👎 to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

@trivikr
Copy link
Author

trivikr commented Aug 2, 2019

Hi, any update on this request?

@trivikr
Copy link
Author

trivikr commented Aug 5, 2019

Hi, any update on this request?
It's pretty complex to implement, but will be helpful in projects where daysUntilClose > daysUntilStale

@trivikr
Copy link
Author

trivikr commented Sep 25, 2019

Any update on this request?

@trivikr
Copy link
Author

trivikr commented Oct 30, 2019

Any update on this?

@stale
Copy link

stale bot commented Jan 28, 2020

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

@stale stale bot added the wontfix label Jan 28, 2020
@stale stale bot closed this as completed Feb 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant