Skip to content
play

GitHub Action

GHA Summarizer

1.0.0 Latest version

GHA Summarizer

play

GHA Summarizer

Simple templating for Github Actions

Installation

Copy and paste the following snippet into your .yml file.

              

- name: GHA Summarizer

uses: VOID404/gha-summarizer@1.0.0

Learn more about this action in VOID404/gha-summarizer

Choose a version

GHA Summarizer GHA Summarizer

Simple action for Go template based summarization of GitHub Actions workflow runs. It supports usual Go templating features, check text/template for more details.

Usage

- name: Render template
  uses: VOID404/gha-summarizer@1.0.0
  with:
    template: hack/summary_template.md
    out-file: summary.md
- name: Set step output
  run: cat summary.md >> $GITHUB_STEP_SUMMARY

Functions

Additionally some helper functions are provided:

filep

Check if file exists.

{{ if filep "./example/code.go" -}}
```go
{{ file "./example/code.go"}}
```
{{- end }}

file

Embedd file content in the template.

# Sample template
```go
{{ file "./example/code.go"}}
```

envp

Checks if environment variable is set.

{{ if envp "GITHUB_REPOSITORY" -}}
{{ env "$GITHUB_REPOSITORY }}
{{- end }}

env

Get environment variable value. This has access to github context, so you can use it to get values from the workflow run.

```md
# Sample template
Generated from `{{ env "$GITHUB_REPOSITORY" }}`
```