-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #248 from py-cov-action/action-on-push
- Loading branch information
Showing
13 changed files
with
525 additions
and
179 deletions.
There are no files selected for viewing
This file contains 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,28 @@ | ||
""" | ||
This module is responsible for identifying what the action should be doing | ||
based on the github event type and repository. | ||
The code in main should be as straightforward as possible, we're offloading | ||
the branching logic to this module. | ||
""" | ||
|
||
|
||
class ActivityNotFound(Exception): | ||
pass | ||
|
||
|
||
def find_activity( | ||
event_name: str, | ||
is_default_branch: bool, | ||
) -> str: | ||
"""Find the activity to perform based on the event type and payload.""" | ||
if event_name == "workflow_run": | ||
return "post_comment" | ||
|
||
if event_name == "push" and is_default_branch: | ||
return "save_coverage_data_files" | ||
|
||
if event_name not in {"pull_request", "push"}: | ||
raise ActivityNotFound | ||
|
||
return "process_pr" |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.