GitHub Actions Toolkit for Python

0.1.15 · maintenance · verified Thu Apr 16

The `actions-toolkit` Python library provides an SDK to simplify the development of GitHub Actions in Python. It offers functionalities for handling inputs, setting outputs, logging, and interacting with the GitHub Actions environment. The current version is 0.1.15, and while functional, it appears to be in maintenance mode with infrequent updates, as more actively developed alternatives like `github-action-toolkit` and `actions-tools` have emerged.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to get an input, log information, and set an output using the `actions-toolkit` library. The `os.environ` lines simulate how GitHub Action inputs are typically provided and how `GITHUB_ACTOR` can be used as a default.

import os
from actions_toolkit import core

# Simulate GitHub Action input 'name'
os.environ['INPUT_NAME'] = os.environ.get('GITHUB_ACTOR', 'World')

try:
    # Get a required input named 'name'
    name = core.get_input('name', required=True)
    
    # Log an informational message
    core.info(f'Hello, {name}!')
    
    # Set an action output named 'greeting'
    core.set_output('greeting', f'Hello, {name}!')
    
    core.info('Action completed successfully.')
except Exception as e:
    core.set_failed(f'Action failed: {e}')

view raw JSON →