Skip to content

A template GitHub action for generating reports for tools (e.g. linters)

License

Notifications You must be signed in to change notification settings

tvcsantos/tool-reporter-action-template

Repository files navigation

Tool Reporter GitHub Action template

test workflow

Overview

This action template repository aims to provide support for generic reporting tools results in your builds.

Several output modes are supported depending on the user input and if the action is run on a pull request:

  • pr-comment - report will be added as a comment on PR.
  • check - report will be added in a GitHub check.
  • summary - report will be added as a summary.

In this example we have implemented it for Kubeconform, a FAST Kubernetes manifests validator, with support for Custom Resources!

Examples

Below we illustrate examples of expected outputs depending on the report mode.

Mode pr-comment

ℹ️ By default when the action runs with pr-comment mode in a non pull-request context this mode will be ignored and if no additional mode was provided we will produce a report using check mode .

When running in pr-comment mode in case of no errors found you will get a comment in you pull request that should look as follows

pr-comment-ok

If errors are found then a nice table will appear in a form of pull request comment highlighting all the important details for the report as in the example below

pr-comment-error

Mode check

When running in check mode a GitHub check will be created to add the report. In case of no errors found your check will succeed, and you will get something as follows

check-ok

If errors are found, the GitHub check will fail, and you will obtain the following

check-error

Mode summary

When running in summary mode a summary will be created with the following if no errors are found

summary-ok

And in case of errors with the following

summary-error

Changelog

All notable changes to this project are documented in CHANGELOG.md.

Usage example

ℹ️ Note that the following example is an illustration for the particular implementation in the example of Kubeconform, so please adapt it to your case.

on:
  push:
    branches:
      - main

jobs:
  build:
    name: Build 
    runs-on: ubuntu-latest
    steps:
      - name: Do Kubeconform report
        uses: tvcsantos/kubeconform-reporter-action@v3
        with:
          file: /path/to/kubeconform/results/file.json

Inputs

ℹ️ Note that the following inputs are an illustration for the particular implementation in the example of Kubeconform, so please adapt them to your case.

Input Type Required Default Value Description
file String Yes - Path to Kubeconform JSON results file.
show-filename Boolean No true Show references to filenames that have errors in the report.
modes List<Enum> No
  • pr-comment, check - on a PR context
  • check - on a non PR context
Report output mode.
  • pr-comment
  • check
  • summary
Multiple output modes can be provided using a multi-line input.
token Token No ${{ github.token }} Your GitHub token.
fail-on-error Boolean No false Fail the action if errors are found on the report.
comment-pr-on-success Boolean No true Comment on PR even if there are no findings.

Outputs

ℹ️ In the example of Kubeconform we don't produce output values, so don't forget to add yours here if required.

No outputs available.

License

This project is released under the MIT License.

Contributions

Contributions are welcome! See Contributor's Guide.

About

A template GitHub action for generating reports for tools (e.g. linters)

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published