Skip to content

Outputs

Bases: FileAttrDictVars

GitHub Actions output variables.

Usage:

class MyOutputs(ActionOutputs):
    my_output: str

action = ActionBase(outputs=MyOutputs())
action.outputs["my-output"] = "value"
action.outputs.my_output = "value"  # the same as above

With attributes, you can only access explicitly declared vars, with dict-like access you can access any var. This way you can find your balance between strictly defined vars and flexibility.

Attribute names are converted to kebab-case. So action.outputs.my_output is the same as action.outputs["my-output"].

If you need to access a snake_case named output like my_output you should use dict-style only: action.outputs["my_output"]. But it's common to use kebab-case in GitHub Actions output names.

Each output var assignment changes the GitHub outputs file (the path is defined as action.env.github_output).