Skip to content

Instantly share code, notes, and snippets.

@jonlabelle
Last active May 21, 2024 21:06

Revisions

  1. jonlabelle revised this gist May 21, 2024. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion github_workflow_message_output.md
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,7 @@ 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]
    > [!NOTE]
    > Requires [debug logging enabled](https://docs.github.com/en/actions/monitoring-and-troubleshooting-workflows/enabling-debug-logging).
    ```console
    @@ -48,6 +48,8 @@ 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](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-a-notice-message)
    @@ -90,6 +92,8 @@ file.
    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](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-error-message)
  2. jonlabelle revised this gist May 21, 2024. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion github_workflow_message_output.md
    Original file line number Diff line number Diff line change
    @@ -101,5 +101,5 @@ run: echo "::error title=Uh oh::Something failed. Here are some steps to correct
    - date: May 21, 2024
    - source: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions
    - snippet: https://jonlabelle.com/snippets/view/markdown/github-workflow-commands-for-message-output
    - gist:
    - gist: https://gist.github.com/jonlabelle/69c79a59c69d2f0bff6dda9348f3fa2d
    ---
  3. jonlabelle created this gist May 21, 2024.
    105 changes: 105 additions & 0 deletions github_workflow_message_output.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,105 @@
    # 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](https://docs.github.com/en/actions/monitoring-and-troubleshooting-workflows/enabling-debug-logging).
    ```console
    ::debug::{message}
    ```

    > [Debug message documentation](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-a-debug-message)
    #### Example debug messages

    ```yaml
    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.
    ```console
    ::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.

    ```yml
    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"
    ```
    > [Notice message documentation](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-a-notice-message)
    ### 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.
    ```console
    ::warning file={name},line={line},endLine={endLine},title={title}::{message}
    ```

    #### Example warning messages

    ```yaml
    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](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-a-warning-message)
    ### 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.
    ```console
    ::error file={name},line={line},endLine={endLine},title={title}::{message}
    ```

    #### Example error messages

    ```yaml
    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."
    ```
    > [Error message documentation](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-error-message)
    ---
    - title: GitHub workflow commands for message output
    - subtitle: Examples of writing GitHub workflow messages to stdout.
    - date: May 21, 2024
    - source: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions
    - snippet: https://jonlabelle.com/snippets/view/markdown/github-workflow-commands-for-message-output
    - gist:
    ---