-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
feat(ci): Automatically close old "Repository Health Check Failed" issues before opening new ones #27165
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
base: master
Are you sure you want to change the base?
Conversation
2b6e8d5 to
71cb3aa
Compare
9e5c9a1 to
2f6e9ea
Compare
- Test termux#27165
- Test termux#27165
|
I ran a test in my fork repository on account @owokitty, which is visible in the GitHub links above, and it does successfully detect my placeholder test "Repository Health Check Failed" issue in my fork, however, unfortunately I wasn't able to complete a full test of detecting and also closing the issue, because when it got to the part of the script where I'm assuming that this error occurs because my fork doesn't have access to the real @termuxbot2 and the real repository to test with, so it doesn't have the GitHub permission to close its own issues like that because my fork repository isn't the same as the real repository. I don't know if there's any way to test whether the same error would occur when attempting to use At the very least, my test has confirmed (I think) that the correct issue gets detected by the |
2f6e9ea to
2848402
Compare
- Test termux#27165
2848402 to
1a12af3
Compare
1a12af3 to
ff493ab
Compare
|
The current implement closes the latest one at a time and then create new. I think it should create the new one then close all the rest of the issues. Or the reverse if the implementation is easier to maintain. |
My original implementation did that (visible in PR commit history above). @TomJo2000 told me to make it close only one issue in this comment: #27165 (comment) , so I changed it to do what he told me. |
That was mostly intended to avoid mishaps like it mass closing unrelated issues in case it got an unfiltered list of issues back somehow. In the general case we should have exactly 0 or 1 prior open health check issue, and that's the only one we'd want to close in favor of the superseding one. |
|
You are closing the latest open issue instead of the oldest open issue so no, the current implementation isnt correct either. I rather go for bulk closing to clear confusion. |
ff493ab to
8d9e768
Compare
I don't understand exactly what you mean would be the difference between the "latest" and "oldest" open issue matching the query in the case when only 1 issue is open, but I have changed this back to how it was at first now. |
|
Good. The current implementation lists all the open issues that will be closed before open a new issue: $ gh issue list \
--limit 99999 \
--label "health-check" \
--state open \
--search "$ISSUE_TITLE in:title type:issue" \
--json number | jq -r '.[] | .number'
27291
27162
27081
27008
26935
26850The previous implementation only list the latest open issue. By Tom's logic the ancient issues are still kept. Bad. $ gh issue list \
--limit 1 \
--label "health-check" \
--state open \
--search "$ISSUE_TITLE in:title type:issue" \
--json number | jq -r '.[] | .number'
27291 |
Tomjo2000's point was that, if all extra issues were manually closed first, then only 1 open matching issue would ever exist at any point in time, meaning that it would never be necessary to match more than 1 issue. The only reason I originally implemented it to close more than 1 issue is because they have been building up for some time without this PR applied, so I wanted it to automatically close all of the preexisting issues the first time it runs. After the first run of this workflow after the PR is merged, the loop will never have more than 1 iteration ever again, but that's ok. |
…sues before opening new ones
8d9e768 to
90310f7
Compare
No description provided.