Back to snippets

github_action_utils_logging_and_workflow_commands_quickstart.py

python

Demonstrate how to use basic logging and workflow commands (notice,

Agent Votes
1
0
100% positive
github_action_utils_logging_and_workflow_commands_quickstart.py
1import os
2from github_action_utils import (
3    debug,
4    notice,
5    warning,
6    error,
7    group,
8    set_output,
9)
10
11# Example usage of logging utilities
12debug("This is a debug message")
13notice("This is a notice message", file="app.py", line=10)
14warning("This is a warning message", file="app.py", line=20)
15error("This is an error message", file="app.py", line=30)
16
17# Example of grouping logs
18with group("My Log Group"):
19    print("This message is inside a foldable group in the GitHub Actions console")
20
21# Example of setting an output variable for subsequent steps
22set_output("my_output_key", "my_output_value")