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

Include option to ignore PR activity #435

Closed
SamirMarin opened this issue May 6, 2021 · 23 comments · Fixed by #540
Closed

Include option to ignore PR activity #435

SamirMarin opened this issue May 6, 2021 · 23 comments · Fixed by #540
Labels
enhancement New feature or request

Comments

@SamirMarin
Copy link

SamirMarin commented May 6, 2021

Background

We currently use github actions on one of our gitops repos to autoupdate PRs with the latest main branch. Because of this PRs are updated frequently and considered to have a high amount of activity.

We wanted to also use github actions (actions/stale) to close PRs that had been open for several days. Currently the following is supported by action/stale:

with:
          repo-token: ${{ token }}
          stale-pr-message: 'This PR is stale because it has been open for 5 days. Remove stale label or this PR will be closed in 3 days.'
          remove-pr-stale-when-updated: false
          days-before-pr-stale: 5
          days-before-pr-close: 3

This works as expected marking any PR as stale (that has not had any activity for 5 days) and closing it 3 days later if still labeled stale.

This however falls slightly short of our use case. For our use case we would like the option to ignore PR activity and mark the PR as stale if it has been open for 5 days (activity or no activity).

Request

Add a flag option such as ignore-pr-activity that ignores PR activity if set to true and simply tracks the time from when the PR was open.
example:

with:
          repo-token: ${{ token }}
          stale-pr-message: 'This PR is stale because it has been open for 5 days. Remove stale label or this PR will be closed in 3 days.'
          remove-pr-stale-when-updated: false
          ignore-pr-activity: true  # defaults to false, when true will count time from the day PR was open ignoring all activity
          days-before-pr-stale: 5
          days-before-pr-close: 3
@luketomlinson luketomlinson added the enhancement New feature or request label May 12, 2021
@pllim
Copy link

pllim commented May 20, 2021

I want something similar but I want push event to be counted, but not the comments. So, a stale PR will not be stale anymore when author updates the code, but it will still be stale if something comments on it or move the milestone.

Case study: astropy/astropy#9856 -- The last push was in Jan 2020, well over the stale limit. But we moved the milestone because our workflow is to attach milestones to all PRs. But actions/stale thinks it is not stale because milestone was moved in April 2021.

2021-05-20T03:18:22.7351365Z [#9856] Found this pull request last updated at: 2021-04-08T22:49:28Z
2021-05-20T03:18:22.7352534Z [#9856] The option only-labels (​https://github.com/actions/stale#only-labels​) was not specified
2021-05-20T03:18:22.7353647Z [#9856] └── Continuing the process for this pull request
2021-05-20T03:18:22.7355561Z [#9856] Days before pull request stale: 150
2021-05-20T03:18:22.7356327Z [#9856] The pull request is not closed nor locked. Trying to remove the close label...
2021-05-20T03:18:22.7358587Z [#9856] This pull request hasn't a stale label
2021-05-20T03:18:22.7359790Z [#9856] The option any-of-labels (​https://github.com/actions/stale#any-of-labels​) was not specified
2021-05-20T03:18:22.7360963Z [#9856] └── Continuing the process for this pull request
2021-05-20T03:18:22.7362664Z [#9856] The option exempt-all-milestones (​https://github.com/actions/stale#exempt-all-milestones​) is disabled. Only some specific milestones on this pull request will skip the stale process
2021-05-20T03:18:22.7364845Z [#9856] ├── The option exempt-pr-milestones (​https://github.com/actions/stale#exempt-pr-milestones​) is disabled. No specific milestone can skip the stale process for this pull request
2021-05-20T03:18:22.7366728Z [#9856] ├── The option exempt-milestones (​https://github.com/actions/stale#exempt-milestones​) is disabled. No specific milestone can skip the stale process for this pull request
2021-05-20T03:18:22.7368630Z [#9856] ├── No milestone option was specified to skip the stale process for this pull request
2021-05-20T03:18:22.7369510Z [#9856] └── Skip the milestones checks
2021-05-20T03:18:22.7370058Z [#9856] This pull request has no assignee
2021-05-20T03:18:22.7370733Z [#9856] └── Skip the assignees checks
2021-05-20T03:18:22.7371256Z [#9856] This pull request is not stale
2021-05-20T03:18:22.7372271Z [#9856] This pull request should not be stale based on the last update date the 08-04-2021 (2021-04-08T22:49:28Z)

Should I open a new issue?

p.s. I see that someone else attempted #390 but I don't think that would help me. I specifically want a PR to un-stale only on push (not supported) or if maintainer manually applies a special label (supported) and nothing else.

@pllim
Copy link

pllim commented May 20, 2021

Idea: Perhaps let users define their own triggers by passing in the param as a list. That way, each user can customize as they see fit without having to keep adding new options. Kinda like how Action handles event triggers for pull_request etc. 💭

@peimanja
Copy link

peimanja commented Jun 1, 2021

Any update on this?

@C0ZEN
Copy link
Contributor

C0ZEN commented Jun 1, 2021

I can provide a PR if you want

@C0ZEN
Copy link
Contributor

C0ZEN commented Jun 1, 2021

The PR is ready.
Is it fitting your needs?

@peimanja
Copy link

peimanja commented Jun 2, 2021

The PR is ready.
Is it fitting your needs?

@C0ZEN Thanks for putting together the PR. In our scenario PRs get autoupdated when a commit gets merged to the default branch so we want to be able to make the PRs stale purely based on the time they were created. Bonus option would be supporting a label so the action ignore them.

@C0ZEN
Copy link
Contributor

C0ZEN commented Jun 2, 2021

@peimanja the new options support this because it uses the creation date instead of the update date to calculate the stale days.

Bonus option would be supporting a label so the action ignore them.

You wish to be able to ignore commits before the stale or after the stale?

@pllim
Copy link

pllim commented Jun 2, 2021

Is it fitting your needs?

Not my particular need, no. Please see #435 (comment) , thanks! Or should I open a separate issue?

@C0ZEN
Copy link
Contributor

C0ZEN commented Jun 2, 2021

@pllim since this PR is only altering the workflow before the stale occur, yes based on your comment it would be wise to open a dedicated feature request.
By the way, for your case the ability to choose either or not a comment should remove the stale is possible with #390.
With the lack of activity, I could provide a PR.

For the milestone case, it's something that doesn't exist at all yet and I think should be in a separated feature request.

@pllim
Copy link

pllim commented Jun 2, 2021

For the milestone case, it's something that doesn't exist at all yet

Doesn't exist in what way; can you please clarify? If there is no way to remove stale when milestone is changed, that is what I want anyway. But if there is no way to exclude milestone from removing stale, then it is not what I want.

@C0ZEN
Copy link
Contributor

C0ZEN commented Jun 3, 2021

The only options right now involving milestones is to avoid staling if there is any milestone set or if there is specific(s) milestone(s).

@peimanja
Copy link

peimanja commented Jun 4, 2021

@peimanja the new options support this because it uses the creation date instead of the update date to calculate the stale days.

Bonus option would be supporting a label so the action ignore them.

You wish to be able to ignore commits before the stale or after the stale?

@C0ZEN So after a PR labeled as stale I want to be able to add a label to the PR so it does not get closed by this action and be ignored. I guess exempt-pr-labels does that so we should be good

C0ZEN added a commit to C0ZEN/stale that referenced this issue Jun 7, 2021
C0ZEN added a commit to C0ZEN/stale that referenced this issue Jun 7, 2021
Helping to close actions#441, actions#470, actions#435?
Closes actions#390 due to no activity

BREAKING CHANGES: the options related to remove-stale-when-updated will only check the updates, not the comment. It is only impactint the configurations using the value at false
@C0ZEN
Copy link
Contributor

C0ZEN commented Jun 7, 2021

@peimanja sadly nope, it's only to avoid staling, not to avoid closing.

@peimanja
Copy link

peimanja commented Jun 7, 2021

@C0ZEN That's fine. I guess in our stale message we can let users know that they have to remove the stale label and add another label so that PR/Issue being ignored by this action

C0ZEN added a commit to C0ZEN/stale that referenced this issue Jun 8, 2021
Helping to close actions#441, actions#470, actions#435?
Closes actions#390 due to no activity

BREAKING CHANGES: the options related to remove-stale-when-updated will only check the updates, not the comment. It is only impactint the configurations using the value at false
@C0ZEN
Copy link
Contributor

C0ZEN commented Jun 8, 2021

@peimanja you are lucky, this PR #468 was merged today, and it will allow the bot to add labels once staled or remove some labels as well!
It's not released yet but available if you use the main branch.

EDIT: sorry it's not when stale but rather when unstale.
Though, the idea to have these options as well when stale is nice IMO!

@C0ZEN
Copy link
Contributor

C0ZEN commented Jun 8, 2021

@peimanja ping because false hopes, sorry! See the edit

C0ZEN added a commit to C0ZEN/stale that referenced this issue Jun 10, 2021
Helping to close actions#441, actions#470, actions#435?
Closes actions#390 due to no activity

BREAKING CHANGES: the options related to remove-stale-when-updated will only check the updates, not the comment. It is only impactint the configurations using the value at false
luketomlinson pushed a commit that referenced this issue Jun 14, 2021
* feat(options): add new options to avoid stale based on comments

Helping to close #441, #470, #435?
Closes #390 due to no activity

BREAKING CHANGES: the options related to remove-stale-when-updated will only check the updates, not the comment. It is only impactint the configurations using the value at false

* style(readme): fix table syntax due to rebase

* docs(readme): add permissions only for the new options
C0ZEN added a commit to C0ZEN/stale that referenced this issue Jun 18, 2021
Helping to close actions#441, actions#470, actions#435?
Closes actions#390 due to no activity

BREAKING CHANGES: the options related to remove-stale-when-updated will only check the updates, not the comment. It is only impactint the configurations using the value at false
C0ZEN added a commit to C0ZEN/stale that referenced this issue Jun 24, 2021
Helping to close actions#441, actions#470, actions#435?
Closes actions#390 due to no activity

BREAKING CHANGES: the options related to remove-stale-when-updated will only check the updates, not the comment. It is only impactint the configurations using the value at false
@github-actions
Copy link
Contributor

github-actions bot commented Jul 9, 2021

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

@github-actions github-actions bot added the Stale label Jul 9, 2021
@C0ZEN
Copy link
Contributor

C0ZEN commented Jul 9, 2021

up

@github-actions github-actions bot removed the Stale label Jul 10, 2021
@peimanja
Copy link

@C0ZEN just checking to see how things are going with your PR, anything is blocking that? 😃

C0ZEN added a commit to C0ZEN/stale that referenced this issue Jul 18, 2021
Helping to close actions#441, actions#470, actions#435?
Closes actions#390 due to no activity

BREAKING CHANGES: the options related to remove-stale-when-updated will only check the updates, not the comment. It is only impactint the configurations using the value at false
@github-actions
Copy link
Contributor

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

@github-actions github-actions bot added the Stale label Aug 16, 2021
@C0ZEN
Copy link
Contributor

C0ZEN commented Aug 16, 2021

up

@github-actions github-actions bot removed the Stale label Aug 17, 2021
@github-actions
Copy link
Contributor

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

@github-actions github-actions bot added the Stale label Sep 16, 2021
@C0ZEN
Copy link
Contributor

C0ZEN commented Sep 16, 2021

up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
5 participants