Skip to content
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

feat: auto-close stale issues and pull requests #907

Merged
merged 6 commits into from Jun 30, 2021
Merged

feat: auto-close stale issues and pull requests #907

merged 6 commits into from Jun 30, 2021

Conversation

eladb
Copy link
Contributor

@eladb eladb commented Jun 29, 2021

Introduce a default behavior to all project types which automatically marks issues and pull requests with a Stale label after a period of inactivity and then closes them.

The defaults stale/close periods in days are:

  • Issues: 60/7
  • Pull requests: 14/2

This feature is only available on projects hosted on GitHub and uses the actions/stale action to automatically mark pull requests and issues as "stale" and close them if they have no activity.

To disable, set stale: false in the project definition.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Use the https://github.com/actions/stale to automatically mark pull requests and issues as "stale" and close them if they have no activity.

To disable, set `stale: false`.
@eladb eladb requested review from iliapolo and nija-at June 29, 2021 09:19
@mergify mergify bot added the contribution/core ⚙️ used by automation label Jun 29, 2021
@codecov-commenter
Copy link

codecov-commenter commented Jun 29, 2021

Codecov Report

Merging #907 (1a59117) into main (377966e) will increase coverage by 6.07%.
The diff coverage is 76.58%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #907      +/-   ##
==========================================
+ Coverage   78.46%   84.54%   +6.07%     
==========================================
  Files          88      107      +19     
  Lines        3181     4101     +920     
  Branches      809     1026     +217     
==========================================
+ Hits         2496     3467     +971     
+ Misses        683      631      -52     
- Partials        2        3       +1     
Impacted Files Coverage Δ
src/file.ts 97.14% <ø> (+0.17%) ⬆️
src/github/auto-merge.ts 91.66% <ø> (-8.34%) ⬇️
src/github/index.ts 100.00% <ø> (ø)
src/java/pom.ts 93.84% <ø> (ø)
src/object-file.ts 100.00% <ø> (+2.38%) ⬆️
src/release/bump-version.ts 97.77% <ø> (ø)
src/release/index.ts 100.00% <ø> (ø)
src/release/release.ts 98.71% <ø> (ø)
src/sample-file.ts 91.48% <ø> (-4.94%) ⬇️
src/source-code.ts 95.45% <ø> (ø)
... and 142 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6cdcafb...1a59117. Read the comment docs.

Copy link
Contributor

@iliapolo iliapolo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet!

src/github/stale.ts Outdated Show resolved Hide resolved
src/github/stale.ts Outdated Show resolved Hide resolved
src/github/stale.ts Show resolved Hide resolved
Elad Ben-Israel and others added 3 commits June 30, 2021 12:49
@eladb eladb changed the title feat: auto-close stable issues and pull requests feat: auto-close stale issues and pull requests Jun 30, 2021
@eladb eladb requested a review from iliapolo June 30, 2021 10:28
@eladb eladb enabled auto-merge (squash) June 30, 2021 10:28
@eladb eladb merged commit 0f2aba6 into main Jun 30, 2021
@eladb eladb deleted the benisrae/stale branch June 30, 2021 10:28
@Chriscbr
Copy link
Contributor

@eladb The docs for "actions/stale" says "If an update/comment occur on stale issues or pull requests, the stale label will be removed and the timer will restart"

It doesn't look like that is happening with the issues you commented on (the label remains). Is it possible this is just a side effect of changing the label post-hoc from "Stale" to "stale"? Or just a bug?

@eladb
Copy link
Contributor Author

eladb commented Jul 1, 2021

@eladb The docs for "actions/stale" says "If an update/comment occur on stale issues or pull requests, the stale label will be removed and the timer will restart"

It doesn't look like that is happening with the issues you commented on (the label remains). Is it possible this is just a side effect of changing the label post-hoc from "Stale" to "stale"? Or just a bug?

Did the stale job run? It is executed every 24h so I think it might have not been executed yet.

@Chriscbr
Copy link
Contributor

Chriscbr commented Jul 5, 2021

On #450 I posted a comment, and the latest run didn't remove the label. Here are the related logs:

[#450] Found this issue last updated at: 2021-07-04T20:16:51Z
[#450] The option only-labels (​https://github.com/actions/stale#only-labels​) was not specified
[#450] └── Continuing the process for this issue
[#450] Days before issue stale: 60
[#450] The issue is not closed nor locked. Trying to remove the close label...
[#450] There is no close label on this issue. Skip
[#450] This issue has a stale label
[#450] The option any-of-labels (​https://github.com/actions/stale#any-of-labels​) was not specified
[#450] └── Continuing the process for this issue
[#450] This issue has no milestone
[#450] └── Skip the milestones checks
[#450] This issue has no assignee
[#450] └── Skip the assignees checks
[#450] This issue is already stale
[#450] Checking for label on this issue
[#450] Issue marked stale on: 2021-07-04T20:16:51Z
[#450] Checking for comments on issue since: 2021-07-04T20:16:51Z
[#450] Comments not made by actor or another bot: 0
[#450] Issue has been commented on: false
[#450] Days before issue close: 7
[#450] Issue has been updated: true
[#450] Stale issue is not old enough to close yet (hasComments? false, hasUpdate? true)

It's odd that it says "Issue marked stale on: 2021-07-04T20:16:51Z" when the stale label was added five days prior. I think it may be the same bug mentioned here: actions/stale#441

They have a PR open that will fix it, so let's wait and see if that resolves it.

@Chriscbr
Copy link
Contributor

Chriscbr commented Jul 8, 2021

@eladb Disable for now? 😕

@eladb
Copy link
Contributor Author

eladb commented Jul 8, 2021

Besides adding/removing the label, is the workflow broken?

Seems like it's doing its job and if users add a comment it won't close the issue. No?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core ⚙️ used by automation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants