repomatic.github.event module¶
Read the event that started a GitHub Actions workflow run.
The runner writes the event payload to the file GITHUB_EVENT_PATH names. The
readers here take the defaults a command needs from it: the issue or pull
request a run is about, its author and number, and the repository’s default
branch.
- class repomatic.github.event.WorkflowEvent(*values)[source]¶
Bases:
StrEnumWorkflow events that cause a workflow to run.
- branch_protection_rule = 'branch_protection_rule'¶
- check_run = 'check_run'¶
- check_suite = 'check_suite'¶
- create = 'create'¶
- delete = 'delete'¶
- deployment = 'deployment'¶
- deployment_status = 'deployment_status'¶
- discussion = 'discussion'¶
- discussion_comment = 'discussion_comment'¶
- fork = 'fork'¶
- gollum = 'gollum'¶
- issue_comment = 'issue_comment'¶
- issues = 'issues'¶
- label = 'label'¶
- merge_group = 'merge_group'¶
- milestone = 'milestone'¶
- page_build = 'page_build'¶
- project = 'project'¶
- project_card = 'project_card'¶
- project_column = 'project_column'¶
- public = 'public'¶
- pull_request = 'pull_request'¶
- pull_request_comment = 'pull_request_comment'¶
- pull_request_review = 'pull_request_review'¶
- pull_request_review_comment = 'pull_request_review_comment'¶
- pull_request_target = 'pull_request_target'¶
- push = 'push'¶
- registry_package = 'registry_package'¶
- release = 'release'¶
- repository_dispatch = 'repository_dispatch'¶
- schedule = 'schedule'¶
- status = 'status'¶
- watch = 'watch'¶
- workflow_call = 'workflow_call'¶
- workflow_dispatch = 'workflow_dispatch'¶
- workflow_run = 'workflow_run'¶
- repomatic.github.event.extract_workflow_filename(workflow_ref)[source]¶
Extract the workflow filename from
GITHUB_WORKFLOW_REF.
- repomatic.github.event.get_github_event() dict[str, Any][source]¶
Load the GitHub event payload from
GITHUB_EVENT_PATH.Every reader here takes a default from the payload, so a payload that cannot be read degrades to no defaults instead of failing the command.
- repomatic.github.event.get_event_pull_request()[source]¶
Return the event payload’s
pull_requestnode, empty when absent.Truthiness, not key presence, is the test every reader below shares. A payload carrying
pull_requestas an empty object has no PR to act on, and it has to read that way tois_pull_request()as well as to the default lookups, or the two would disagree on which node they read.
- repomatic.github.event.get_event_subject()[source]¶
Return the issue or pull request the current event is about.
Pull requests win: the two nodes are mutually exclusive on the events these readers handle, and preferring the PR keeps the lookups reading the same node
is_pull_request()reports on.
- repomatic.github.event.get_default_author()[source]¶
Get the issue/PR author from the GitHub event payload.
- repomatic.github.event.get_default_number()[source]¶
Get the issue/PR number from the GitHub event payload.
