GitHub Action
GitHub Checks
This GitHub Action allows you to create Check Runs directly from your GitHub Action workflow. While each job of a workflow already creates a Check Run, this Action allows to include annotations
, images
, actions
or any other parameters supported by the Check Runs API.
The following shows how to publish a Check Run which will have the same status as your job and contains the output of another action. This will be shown predominantly in a Pull Request or on the workflow run.
name: "build-test"
on: [push]
jobs:
test_something:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/create-outputs@v0.0.0-fake
id: test
- uses: LouisBrunner/checks-action@v2.0.0
if: always()
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: Test XYZ
conclusion: ${{ job.status }}
output: |
{"summary":"${{ steps.test.outputs.summary }}"}
See the examples workflow for more details and examples (and see the associated runs to see how it will look like).
When the action is run as part of a Pull Request, your workflow might fail with the following error: Error: Resource not accessible by integration
.
You can solve this in multiple ways:
- Increase the permissions given to
GITHUB_TOKEN
(see actions/first-interaction#10 (comment)), please note that you should understand the security implications of this change - Use a Github App token instead of a
GITHUB_TOKEN
(see #26 (comment))
Most of the time, it means setting up your workflow this way:
name: "build-test"
on: [push]
jobs:
test_something:
runs-on: ubuntu-latest
permissions:
checks: write
contents: read
steps:
- uses: actions/checkout@v1
- uses: actions/create-outputs@v0.0.0-fake
id: test
- uses: LouisBrunner/checks-action@v2.0.0
if: always()
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: Test XYZ
conclusion: ${{ job.status }}
output: |
{"summary":"${{ steps.test.outputs.summary }}"}
Notice the extra permissions
section.
Optional The target repository (owner/repo
) on which to manage the check run. Defaults to the current repository.
Optional The SHA of the target commit. Defaults to the current commit.
Required Your GITHUB_TOKEN
Required for creation, the name of the check to create (mutually exclusive with check_id
)
Required for update, ID of the check to update (mutually exclusive with name
)
Optional (Required if status
is completed
, the default) The conclusion of your check, can be either success
, failure
, neutral
, cancelled
, timed_out
, action_required
or skipped
Optional The status of your check, defaults to completed
, can be either queued
, in_progress
, completed
Optional The URL to call back to when using action_required
as a conclusion
of your check or when including actions
See Check Runs API (action_required
) or Check Runs API (actions
) for more information
Note that this will override details_url
(see next) when conclusion
is action_required
or when actions
is provided (the two inputs set the same check attribute, details_url
)
Optional A URL with more details about your check, can be an third-party website, a preview of the changes to your Github Pages, etc
Note that this will be overridden by action_url
(see previous) when conclusion
is action_required
or when actions
is provided (the two inputs set the same check attribute, details_url
)
Optional A JSON object (as a string) containing the output of your check, required when using annotations
or images
.
Supports the following properties:
title
: Optional, title of your check, defaults toname
summary
: Required, summary of your checktext_description
: Optional, a text description of your annotation (if any)
See Check Runs API for more information
Optional Path to a file containing text which should be set as the text_description
property of output
'. Can contain plain text or markdown.
Note that this will be ignored if output
is not provided. When output
is provided with a text_description, this input will take precedence and override it.
Optional A JSON array (as a string) containing the annotations of your check, requires output
to be included.
Supports the same properties with the same types and names as the Check Runs API
Optional A JSON array (as a string) containing the images of your check, requires output
to be included.
Supports the same properties with the same types and names as the Check Runs API
Optional A JSON array (as a string) containing the actions of your check.
Supports the same properties with the same types and names as the Check Runs API
Note that this will override details_url
as it relies on action_url
(the two inputs set the same check attribute, details_url
)
The ID of the created check, useful to update it in another action (e.g. non-completed
status
)
- Action Required conclusion: button doesn't work?
- Action elements: button doesn't work?
- Non-completed status: too many arguments required