Skip to content

Instantly share code, notes, and snippets.

@jonlabelle
Last active May 21, 2024 21:06
Show Gist options
  • Save jonlabelle/69c79a59c69d2f0bff6dda9348f3fa2d to your computer and use it in GitHub Desktop.
Save jonlabelle/69c79a59c69d2f0bff6dda9348f3fa2d to your computer and use it in GitHub Desktop.
Examples of writing GitHub workflow messages to stdout.

GitHub workflow commands for message output

Use the :: syntax to run the workflow commands within your YAML file; these commands are then sent to the runner over stdout.

Message output

Debug

Prints a debug message to the log. You must create a secret named ACTIONS_STEP_DEBUG with the value true to see the debug messages set by this command in the log.

Note

Requires debug logging enabled.

::debug::{message}

Debug message documentation

Example debug messages

run: echo "::debug::Set the Octocat variable"

Notice

Creates a notice message and prints the message to the log. This message will create an annotation, which can associate the message with a particular file in your repository. Optionally, your message can specify a position within the file.

::notice file={name},line={line},endLine={endLine},title={title}::{message}

Example notice messages

Creates a notice message and prints the message to the log. This message will create an annotation, which can associate the message with a particular file in your repository. Optionally, your message can specify a position within the file.

run: echo "::notice file=app.js,line=1,col=5,endColumn=7::Missing semicolon"

run: echo "::notice title=Heads up::I need to make you aware of something"

run: echo "::notice title=✓ Test passed::Have a great rest of the day/night!"

Notice message documentation

Warning

Creates a warning message and prints the message to the log. This message will create an annotation, which can associate the message with a particular file in your repository. Optionally, your message can specify a position within the file.

::warning file={name},line={line},endLine={endLine},title={title}::{message}

Example warning messages

run: echo "::warning file=app.js,line=1,col=5,endColumn=7::Missing semicolon"

run: echo "::warning title=Oops::Something didn't go quite as expected"

Warning message documentation

Error

Creates an error message and prints the message to the log. This message will create an annotation, which can associate the message with a particular file in your repository. Optionally, your message can specify a position within the file.

::error file={name},line={line},endLine={endLine},title={title}::{message}

Example error messages

run: echo "::error file=app.js,line=1,col=5,endColumn=7::Missing semicolon"

run: echo "::error title=Uh oh::Something failed. Here are some steps to correct the problem."

run: echo "::error title=✘ Test failed::You probably want to fix this."

Error message documentation



Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment