Actions Python Core
raw JSON → 0.1.3 verified Mon Apr 27 auth: no python
A core library for building GitHub Actions in Python, providing utilities for interacting with the Actions runtime (inputs, outputs, commands, path manipulation). Current version 0.1.3, pre-1.0 with frequent breaking changes.
pip install actions-python-core Common errors
error ModuleNotFoundError: No module named 'core' ↓
cause Importing 'core' directly instead of 'actions.core'.
fix
Use 'from actions import core' or 'from actions.core import ...'.
error AttributeError: module 'actions' has no attribute 'core' ↓
cause Missing 'actions-python-core' installation or wrong import path.
fix
Run 'pip install actions-python-core' and import as 'from actions import core'.
error TypeError: get_input() missing 1 required positional argument: 'name' ↓
cause Calling get_input() without any arguments.
fix
Provide input name: core.get_input('input-name')
Warnings
breaking Top-level import path changed from 'core' to 'actions.core' in v0.1.0. ↓
fix Use 'from actions import core' or 'from actions.core import ...'.
deprecated core.get_input() returns empty string for missing inputs (previously raised error). Rely on required=True for validation. ↓
fix Use core.get_input('name', required=True) to enforce presence.
gotcha set_output and set_failed must be called inside try block or will not propagate error correctly. ↓
fix Wrap action logic in try/except and call core.set_failed in except.
Imports
- core wrong
import corecorrectfrom actions import core - get_input wrong
from core import get_inputcorrectfrom actions.core import get_input
Quickstart
from actions import core
try:
name = core.get_input('who-to-greet')
print(f'Hello {name}')
core.set_output('time', '2023-01-01')
except Exception as e:
core.set_failed(f'Action failed: {e}')