-
Notifications
You must be signed in to change notification settings - Fork 43
Add support for custom event dispatching #621
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: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -74,38 +74,43 @@ | |
| github=gh, repository=config.GITHUB_REPOSITORY | ||
| ) | ||
| try: | ||
| activity = activity_module.find_activity( | ||
| event_name=event_name, | ||
| is_default_branch=repo_info.is_default_branch(ref=config.GITHUB_REF), | ||
| event_type=config.GITHUB_EVENT_TYPE, | ||
| is_pr_merged=config.IS_PR_MERGED, | ||
| ) | ||
| if config.ACTIVITY: | ||
| activity = activity_module.validate_activity(config.ACTIVITY) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like it's the only line missing coverage: #621 (comment) |
||
| else: | ||
| activity = activity_module.find_activity( | ||
| event_name=event_name, | ||
| is_default_branch=repo_info.is_default_branch(ref=config.GITHUB_REF), | ||
| event_type=config.GITHUB_EVENT_TYPE, | ||
| is_pr_merged=config.IS_PR_MERGED, | ||
| ) | ||
| except activity_module.ActivityNotFound: | ||
| log.error( | ||
| 'This action has only been designed to work for "pull_request", "push", ' | ||
| f'"workflow_run", "schedule" or "merge_group" actions, not "{event_name}". Because there ' | ||
| "are security implications. If you have a different usecase, please open an issue, " | ||
| "we'll be glad to add compatibility." | ||
| "This action's default behavior is to determine the appropriate " | ||
| "mode based on the current branch, whether or not it's in a pull " | ||
| "request, and if that pull request is open or closed. This " | ||
| "frequently results in the correct action taking place, but is " | ||
| "only a heuristic. If you need more precise control, you should " | ||
| 'specify the "ACTIVITY" parameter as described in the documentation.' | ||
| ) | ||
| return 1 | ||
|
|
||
| if activity == "save_coverage_data_files": | ||
| if activity == activity_module.Activity.SAVE_COVERAGE_DATA_FILES: | ||
| return save_coverage_data_files( | ||
| config=config, | ||
| git=git, | ||
| http_session=http_session, | ||
| repo_info=repo_info, | ||
| ) | ||
|
|
||
| elif activity == "process_pr": | ||
| elif activity == activity_module.Activity.PROCESS_PR: | ||
| return process_pr( | ||
| config=config, | ||
| gh=gh, | ||
| repo_info=repo_info, | ||
| ) | ||
|
|
||
| else: | ||
| # activity == "post_comment": | ||
| # activity == activity_module.Activity.POST_COMMENT: | ||
| return post_comment( | ||
| config=config, | ||
| gh=gh, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -66,6 +66,7 @@ class Config: | |
| ANNOTATION_TYPE: str = "warning" | ||
| MAX_FILES_IN_COMMENT: int = 25 | ||
| USE_GH_PAGES_HTML_URL: bool = False | ||
| ACTIVITY: str | None = None | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You may define this as a (see https://typing.python.org/en/latest/spec/narrowing.html#typeguard) |
||
| VERBOSE: bool = False | ||
| # Only for debugging, not exposed in the action: | ||
| FORCE_WORKFLOW_RUN: bool = False | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Who turns
""intoNone? I think there should be some code somewhere doing that, and I'm not seeing it. Am I missing something or is it missing ?