[Backport release-24.11] Reapply "workflows/labels: manage stale & merge conflict labels"#419802
Merged
wolfgangwalther merged 8 commits intorelease-24.11from Jun 25, 2025
Merged
Conversation
To set the stale label properly, we need to consider the right timeline events only - and their respective relevant timestamps. (cherry picked from commit d5072dd)
When running in a pull_request context, the labels job is part of the currently running workflow - which will never have succeeded, yet. Apparently it could be failed already, so in this case we take *any* workflow run, no matter its state. (cherry picked from commit ed1fc4c)
Explained very well by the code comment. (cherry picked from commit 39dc87d)
This should make sure that the timer is cleaned up, no matter what. This didn't seem to be the case before, where it would still be stuck sometimes, when throwing an error somewhere. (cherry picked from commit ddf3480)
…l requests It's necessary to use a combination of different endpoints here, because the /search endpoint only allows fetching the first 1000 items and will fail with a higher page number (11+). On the flip side, the /pulls endpoint doesn't allow counting the total number of results, so we can't calculate the required page number with its response. Putting both together should work, though. (cherry picked from commit 579bfd4)
2 tasks
With the help of: https://stackabuse.com/how-to-sort-an-array-by-date-in-javascript/ (cherry picked from commit c925737)
The previous implementation had two problems: - When switching from /search to /pulls, we disabled the additional GET on each single pull request - which causes no test merge commit creation for all PRs. This means, merge conflicts will not actually be detected. - By using `item` in the pull-request triggered case, this goes back to `context.payload.pull_request`, which is the state *at the beginning* of the workflow run. But this renders our "let's wait 3 minutes before checking merge_commit_sha" logic void. While we wait for 3 minutes, we still use the *old* value afterwards... Just making the extra request every time simplifies the logic and solves both problems. (cherry picked from commit 59ac947)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bot-based backport to
release-24.11, triggered by a label in #419654.