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

Adjust the sync label bot to reflect recent GitHub CLI changes #36894

Merged
merged 2 commits into from
Dec 19, 2023

Conversation

soehms
Copy link
Member

@soehms soehms commented Dec 15, 2023

At least since version 2.40.0 of gh the output of gh auth status has changed. This broke the method bot_login where the bot's login name is obtained. The first failure appeared on 13.12 in this scheduled run. More specifically, the word before the login name used for positioning has changed from as to account.

In a logfile it looks like this:

Run chmod a+x .github/sync_labels.py
INFO:root:cmdline_args (1) ['https://github.com/sagemath/sage']
INFO:root:url: https://github.com/sagemath/sage
INFO:root:Create label handler for pull request #sage and actor sagetrac-github-bot
Traceback (most recent call last):
  File "/home/runner/work/sage/sage/.github/sync_labels.py", line 1081, in <module>
    gh = GhLabelSynchronizer(url, default_actor)
  File "/home/runner/work/sage/sage/.github/sync_labels.py", line 157, in __init__
    self.bot_login()
  File "/home/runner/work/sage/sage/.github/sync_labels.py", line 244, in bot_login
    self._bot_login = l[l.index('as')+1]
ValueError: 'as' is not in list
Error: Process completed with exit code 1.

This PR does the following:

  • implements an adjustment to this change
  • avoids raising an error if the bot name cannot be discovered (to better behave with similar changes in the future)
  • adds more log messages to make it easier to identify similar issues

📝 Checklist

  • The title is concise, informative, and self-explanatory.
  • The description explains in detail what this PR is about.
  • I have linked a relevant issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation accordingly.

⌛ Dependencies

@soehms soehms added this to the sage-10.3 milestone Dec 15, 2023
@soehms soehms marked this pull request as ready for review December 15, 2023 18:51
@soehms
Copy link
Member Author

soehms commented Dec 15, 2023

Example of a successful run in my fork repository:

Run chmod a+x .github/sync_labels.py
INFO:root:cmdline_args (5) ['labeled', 'https://github.com/soehms/sage/issues/1', 'soehms', 'p: minor /4', '']
INFO:root:action: Action.labeled
INFO:root:url: https://github.com/soehms/sage/issues/1
INFO:root:actor: soehms
INFO:root:label: p: minor /4
INFO:root:rev_state: 
INFO:root:Create label handler for issue #1 and actor soehms

INFO:root:version: b'gh version 2.40.0 (2023-12-07)

DEBUG:root:auth status err: b''
DEBUG:root:auth status out: b'github.com\n  \xe2\x9c\x93 Logged in to github.com account github-actions[bot] (GITHUB_TOKEN)\n  - Active account: true\n  - Git operations protocol: https\n  - Token: ghs_************************************\n'

INFO:root:Bot is github-actions

DEBUG:root:Execute command: gh api -X GET -H "Accept: application/vnd.github+json" /repos/soehms/sage/issues/comments -f per_page=100 -f page=1 -f since=2023-12-15T05:48:58Z
INFO:root:Cleaning warning comments since 2023-12-15 05:48:58.477877 (total found 1)
DEBUG:root:github-actions comment 1858276216 created at 2023-12-15T17:57:47Z on issue 1 found
DEBUG:root:github-actions Label Sync Warning: 1858276216 is 0:01:11.477877 old
DEBUG:root:Execute command: gh issue view https://github.com/soehms/sage/issues/1 --json labels
INFO:root:List of labels for issue #1: ['p: minor /4', 'p: major /3']
DEBUG:root:Execute command: gh issue edit https://github.com/soehms/sage/issues/1 --remove-label "p: major /3"
https://github.com/soehms/sage/issues/1
INFO:root:Remove label from issue #1: p: major /3

Copy link

Documentation preview for this PR (built with commit a032c79; changes) is ready! 🎉

@kwankyu
Copy link
Collaborator

kwankyu commented Dec 16, 2023

OK.

How's it going with github "labels not immediately updated after changed" bug?

@soehms
Copy link
Member Author

soehms commented Dec 16, 2023

OK.

Thanks!

How's it going with github "labels not immediately updated after changed" bug?

Pretty frustrating. The ticket (https://support.github.com/ticket/personal/0/2448092) was closed without providing a substantive answer (I wonder if this is general GitHub policy). They just confirm that it is a known bug that will be fixed one day.
The bug is currently not fixed. I think we should reopen the ticket from time to time and ask for progress. Maybe this would be more powerful if it wasn't just me doing it.

@kwankyu
Copy link
Collaborator

kwankyu commented Dec 16, 2023

... They just confirm that it is a known bug that will be fixed one day. The bug is currently not fixed.

Hopefully it is on some github developer's TODO list, instead of forgotten.

@vbraun vbraun merged commit a8f38e8 into sagemath:develop Dec 19, 2023
19 of 20 checks passed
@soehms soehms deleted the adapt_sync_labels_to_gh_changes branch December 19, 2023 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants