Skip to content

Markdown Summary Template

Actions
Add custom step summaries to your workflows with ease. No more 200 lines of echo ... $GITHUB_STEP_SUMMARY
v1.1.0
Latest
Star (1)

Markdown Template Action

Quickly build markdown summaries for your workflows.

  • Supports environment variable injection
  • Allows you to write summaries in YAML
  • Much easier deal with comparing with inline bash summaries.

Example usage

The following is an extract from our example-template.yml workflow. You can see it in action by going to the Actions tab in this repo.

steps:
  - uses: WcAServices/markdown-template-action@v1
    with:
      # These will be injected into the below template, in addition to GitHub's standard
      # variables. You can perform string operations here as well.
      variables: >-
        GREETING="world"
        COMMIT_SHA="${{ github.sha }}"
        SHORT_SHA=${COMMIT_SHA:0:7}
        
      # The following language="..." comment enables syntax highlighting in JetBrains IDEs
      
      # language="markdown"
      template: |
         # Hello, $GREETING
         > ### You're on commit [`$SHORT_SHA`]($COMMIT_SHA)            

         ##### Standard GitHub variables should work too:
         ```yaml
         Github Ref: $GITHUB_REF
         Commit author: $GITHUB_ACTOR
         Job: $GITHUB_JOB
         ```
      

Result

Once your workflow has completed, you'll receive a nice summary at the bottom of the page with your markdown template. Using the workflow above, you should end up with something like the following;

image

Reasoning

When building step summaries, you tend to get stuck with GitHub's suggested apporoach where you simply echo into the step summary variable. This can quickly get very verbose when you get into slightly more advanced markdown formatting:

  • A great alternative to the following templating workflow; 👎

    echo "# Tests are failing"                                         >> $GITHUB_STEP_SUMMARY
    echo "> Go blame $GITHUB_ACTOR who pushed to $GITHUB_BASE_REF"     >> $GITHUB_STEP_SUMMARY
    echo ""                                                            >> $GITHUB_STEP_SUMMARY
    echo '```'                                                         >> $GITHUB_STEP_SUMMARY
    echo "$TEST_SUMMARY_RESULTS"                                       >> $GITHUB_STEP_SUMMARY
    echo '```'                                                         >> $GITHUB_STEP_SUMMARY

Markdown Summary Template is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Add custom step summaries to your workflows with ease. No more 200 lines of echo ... $GITHUB_STEP_SUMMARY
v1.1.0
Latest

Markdown Summary Template is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.