Contents Menu Expand Light mode Dark mode Auto light/dark, in light mode Auto light/dark, in dark mode Skip to content
github-action-toolkit v0.9.0
github-action-toolkit v0.9.0

Getting Started

  • Installation
  • Quickstart Guide
  • Comparison with Javascript @actions/toolkit

Guides

  • Example Workflows
  • Local Development and Testing for Custom GitHub Actions
  • Error Handling
  • Security Best Practices

API Reference and Guide

  • Print Functions
  • Annotations
  • User Inputs
  • Action Outputs
  • Environment Variables
  • Job Summary
  • Job Summary Templates
  • Exception Handling
  • Signal Handling & Cancellation
  • GitHub Event Payload
  • Git Repository Manager
  • GitHub Artifacts
  • GitHub API Client
  • GitHub Cache
  • Debugging Utilities

Development

  • Changelog
  • Contributing
  • License
  • GitHub Repository
Back to top
View this page

Print Functions¶

Output messages to the GitHub Actions console with different severity levels.

API Reference¶

echo(message, use_subprocess=False)¶

Prints specified message to the action workflow console.

example:

>> from github_action_toolkit import echo

>> echo("Hello World")

# Output:
# Hello World

info(message, use_subprocess=False)¶

Prints specified message to the action workflow console. (Same function as echo())

example:

>> from github_action_toolkit import info

>> info("Hello World-1")

# Output:
# Hello World-1

debug(message, use_subprocess=False)¶

Prints colorful debug message to the action workflow console. GitHub Actions Docs: debug

example:

>> from github_action_toolkit import debug

>> debug("Hello World")

# Output:
# ::debug ::Hello World

notice(message, title=None, file=None, col=None, end_column=None, line=None, end_line=None, use_subprocess=False)¶

Prints colorful notice message to the action workflow console. GitHub Actions Docs: notice

example:

>> from github_action_toolkit import notice

>> notice(
    "test message",
    title="test title",
    file="abc.py",
    col=1,
    end_column=2,
    line=4,
    end_line=5,
)

# Output:
# ::notice title=test title,file=abc.py,col=1,endColumn=2,line=4,endLine=5::test message=

warning(message, title=None, file=None, col=None, end_column=None, line=None, end_line=None, use_subprocess=False)¶

Prints colorful warning message to the action workflow console. GitHub Actions Docs: warning

example:

>> from github_action_toolkit import warning

>> warning(
    "test message",
    title="test title",
    file="abc.py",
    col=1,
    end_column=2,
    line=4,
    end_line=5,
)

# Output:
# ::warning title=test title,file=abc.py,col=1,endColumn=2,line=4,endLine=5::test message

error(message, title=None, file=None, col=None, end_column=None, line=None, end_line=None, use_subprocess=False)¶

Prints colorful error message to the action workflow console. GitHub Actions Docs: error

example:

>> from github_action_toolkit import error

>> error(
    "test message",
    title="test title",
    file="abc.py",
    col=1,
    end_column=2,
    line=4,
    end_line=5,
)

# Output:
# ::error title=test title,file=abc.py,col=1,endColumn=2,line=4,endLine=5::test message

add_mask(value, use_subprocess=False)¶

Masking a value prevents a string or variable from being printed in the workflow console. GitHub Actions Docs: add_mask

example:

>> from github_action_toolkit import add_mask

>> add_mask("test value")

# Output:
# ::add-mask ::test value

start_group(title, use_subprocess=False) and end_group(use_subprocess=False)¶

Creates an expandable group in the workflow log. GitHub Actions Docs: group

example:

>> from github_action_toolkit import echo, start_group, end_group, group

>> start_group("My Group Title")
>> echo("Hello World")
>> end_group()

# Output:
# ::group ::My Group Title
# Hello World
# ::endgroup::

# ====================
# Using Group Context Manager
# ====================

>> with group("My Group Title"):
...   echo("Hello World")

# Output:
# ::group ::My Group Title
# Hello World
# ::endgroup::

Examples and Best Practices¶

Progress Groups¶

from github_action_toolkit import group, info

stages = ['setup', 'build', 'test', 'deploy']

for stage in stages:
    with group(f'Stage: {stage}'):
        info(f'Starting {stage}...')
        # Do work
        info(f'Completed {stage}')

Nested Groups¶

from github_action_toolkit import group, info

with group('Build Process'):
    info('Starting build...')
    
    with group('Compile Source'):
        info('Compiling main.py...')
        info('Compiling utils.py...')
    
    with group('Run Tests'):
        info('Running unit tests...')
        info('Running integration tests...')
    
    info('Build complete!')

Conditional Groups¶

from github_action_toolkit import group, info, get_user_input_as

verbose = get_user_input_as('verbose', bool, default_value=False)

if verbose:
    with group('Detailed Information'):
        info('Python version: 3.11')
        info('Platform: Linux')
        info('Working directory: /home/runner/work')
Next
Annotations
Previous
Security Best Practices
Copyright © 2026, Vatsal Jagani
Made with Sphinx and @pradyunsg's Furo
On this page
  • Print Functions
    • API Reference
      • echo(message, use_subprocess=False)
      • info(message, use_subprocess=False)
      • debug(message, use_subprocess=False)
      • notice(message, title=None, file=None, col=None, end_column=None, line=None, end_line=None, use_subprocess=False)
      • warning(message, title=None, file=None, col=None, end_column=None, line=None, end_line=None, use_subprocess=False)
      • error(message, title=None, file=None, col=None, end_column=None, line=None, end_line=None, use_subprocess=False)
      • add_mask(value, use_subprocess=False)
      • start_group(title, use_subprocess=False) and end_group(use_subprocess=False)
    • Examples and Best Practices
      • Progress Groups
      • Nested Groups
      • Conditional Groups