pontos.github.actions package

exception pontos.github.actions.GitHubActionsError

A GitHub Actions related error has occurred

class pontos.github.actions.ActionIO

Class with static methods for handling GitHub Action IO

static has_output()

Check if GITHUB_OUTPUT is set

Return type:

bool

static input(name, default=None)

Get the value of an action input

Example

from pontos.github.actions import ActionIO

value = ActionIO.input("foo", "bar")
Parameters:
  • name (str) – Name of the input variable

  • default (str | None) – Use as default if the is no value for the variable

Return type:

str | None

static multiline_output(name, value)

Set an multiline action output

An action output can be consumed by another job

Example

from pontos.github.actions import ActionIO

ActionIO.output("foo", "bar")
Parameters:
  • name (str) – Name of the output variable

  • value (SupportsStr) – Value of the output variable

static out()

Create an action output to write several output values

An action output can be consumed by another job

Example

from pontos.github.actions import ActionIO

with ActionIO.out() as out:
    out.write("foo", "bar")
    out.write("lorem", "ipsum")
Return type:

Generator[ActionOutput, None, None]

static output(name, value)

Set action output

An action output can be consumed by another job

Example

from pontos.github.actions import ActionIO

ActionIO.output("foo", "bar")
Parameters:
  • name (str) – Name of the output variable

  • value (SupportsStr) – Value of the output variable

class pontos.github.actions.ActionOutput(file)

A GitHub Action output

write(name, value)

Set action output

An action output can be consumed by another job

Parameters:
  • name (str) – Name of the output variable

  • value (SupportsStr) – Value of the output variable

class pontos.github.actions.Console

Class for printing messages to the action console

static debug(message)

Print a debug message to the console

These messages are only shown if the secret ACTIONS_STEP_DEBUG is set to true. See https://docs.github.com/en/actions/monitoring-and-troubleshooting-workflows/enabling-debug-logging#enabling-step-debug-logging

static end_group()

End the last group

static error(message, *, name=None, line=None, end_line=None, column=None, end_column=None, title=None)

Print an error message

This message will also be shown at the action summary

classmethod group(title)

ContextManager to display a foldable group

from pontos.github.actions import Console

console = Console()
with console.group("my-group"):
    console.log("some message")
Parameters:

title (str) – Title of the group

static log(message)

Print a message to the console

static notice(message, *, name=None, line=None, end_line=None, column=None, end_column=None, title=None)

Print a warning message

This message will also be shown at the action summary

static start_group(title)

Start a new foldable group

Parameters:

title (str) – Title of the group

static warning(message, *, name=None, line=None, end_line=None, column=None, end_column=None, title=None)

Print a warning message

This message will also be shown at the action summary

class pontos.github.actions.GitHubEnvironment

Class to handle values from the GitHub Environment

https://docs.github.com/en/actions/learn-github-actions/environment-variables

class pontos.github.actions.GitHubEvent(event_path)

GitHub Actions provides event data for the running action as JSON data in a local file at the runner.

The JSON data for the events is specified at https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads

pull_request

Information about the pull request

Type:

pontos.github.actions.event.GitHubPullRequestEvent

Loads the event data from the passed path

Parameters:

event_path (Path) – Path to the event data

class pontos.github.actions.Label(name)

A label of a pull request or issue

class pontos.github.actions.Ref(name, sha)

A git branch reference

name

Name of the git branch reference for example main

Type:

str

sha

Git commit ID of the reference

Type:

str

class pontos.github.actions.PullRequestState(*values)

State of a pull request

OPEN

The pull request is open

CLOSED

The pull request is closed

class pontos.github.actions.GitHubPullRequestEvent(pull_request_data)

Event data of a GitHub Pull Request

https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#pull_request

draft

True if the pull request is a draft

Type:

bool | None

number

ID of the pull request

Type:

int | None

labels

Labels attached to the pull request

Type:

Iterable[str] | None

title

Title of the pull request

Type:

str | None

merged

True if the pull request is already merged

Type:

bool | None

state

State of the pull request (open, closed)

Type:

pontos.github.actions.event.PullRequestState

base

Base reference of the pull request (target branch)

Type:

pontos.github.actions.event.Ref

head

Head reference of the pull request (source branch)

Type:

pontos.github.actions.event.Ref

Derive the pull request information from the pull request data of a GitHub event.

Parameters:

pull_request_data (Dict[str, Any]) – JSON based pull request information as dict