-
-
Notifications
You must be signed in to change notification settings - Fork 99
[feature] Automate assigning/unassigning issues #571 #572
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
Merged
nemesifier
merged 8 commits into
openwisp:master
from
Eeshu-Yadav:issues/571-automate-assigning-unassigning-issues
Mar 8, 2026
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
c761346
[feature] Automate assigning/unassigning issues #571
Eeshu-Yadav a8cdf45
[fix] Address remaining review findings #571
Eeshu-Yadav 50da3dd
[fix] Update docs to use extra require for bot dependencies #571
Eeshu-Yadav 9449289
[fix] Update docs to use extra require for bot dependencies #571
Eeshu-Yadav 5697f51
[fix] Address further kilo-code-bot review feedback #571
Eeshu-Yadav dde5fb0
[fix] Address round 4 review feedback #571
Eeshu-Yadav 8d3bd07
[fix] Refactor auto-assign to reuse shared utils #571
Eeshu-Yadav b94d023
[fix] Address further kilo-code-bot review feedback openwisp#571
Eeshu-Yadav File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| import sys | ||
| import traceback | ||
|
|
||
|
|
||
| def main(): | ||
| if len(sys.argv) < 2: | ||
| print( | ||
| "Usage: python __main__.py <bot_type> [args...]\n" | ||
| "Available bot types: issue_assignment, stale_pr, pr_reopen" | ||
| ) | ||
| return 1 | ||
|
|
||
| bot_type = sys.argv[1] | ||
|
|
||
| try: | ||
| sys.argv = [sys.argv[0]] + sys.argv[2:] | ||
|
|
||
| if bot_type == "issue_assignment": | ||
| from issue_assignment_bot import main as issue_main | ||
|
|
||
| return issue_main() | ||
| elif bot_type == "stale_pr": | ||
| from stale_pr_bot import main as stale_main | ||
|
|
||
| return stale_main() | ||
| elif bot_type == "pr_reopen": | ||
| from pr_reopen_bot import main as pr_main | ||
|
|
||
| return pr_main() | ||
| else: | ||
| print(f"Unknown bot type: {bot_type}") | ||
| print("Available bot types: " "issue_assignment, stale_pr, pr_reopen") | ||
| return 1 | ||
| except Exception as e: | ||
| print(f"Error running {bot_type} bot: {e}") | ||
| traceback.print_exc() | ||
| return 1 | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| sys.exit(main()) | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import os | ||
|
|
||
| from github import Github | ||
Eeshu-Yadav marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
| class GitHubBot: | ||
| def __init__(self): | ||
| self.github_token = os.environ.get("GITHUB_TOKEN") | ||
| self.repository_name = os.environ.get("REPOSITORY") | ||
| self.event_name = os.environ.get("GITHUB_EVENT_NAME") | ||
| self.event_payload = None | ||
|
|
||
| if self.github_token and self.repository_name: | ||
| try: | ||
| self.github = Github(self.github_token) | ||
| self.repo = self.github.get_repo(self.repository_name) | ||
| except Exception as e: | ||
| print(f"Warning: Could not initialize GitHub client: {e}") | ||
| self.github = None | ||
| self.repo = None | ||
| else: | ||
| print("Warning: GITHUB_TOKEN or REPOSITORY env vars not set") | ||
| self.github = None | ||
| self.repo = None | ||
|
|
||
| def load_event_payload(self, event_payload): | ||
| self.event_payload = event_payload | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.