Custom "details" link in the github pr checks

Viewed 407

I saw that Chromatic action is able to change the "details" link in PR check and post an additional comment. Can someone help me to set it up in my own workflow? check the image for example

3 Answers

You can create a custom check for your PR using the GitHub REST API. In particular, you want to look at Checks - Create a check run. Part of the payload for that endpoint is a field called details_url where you can specify the URL.

Sample API call with curl:

curl \
  -X POST \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/repos/octocat/hello-world/check-runs \
  -d '{"name":"name","head_sha":"head_sha", "details_url": "https://my-custom-url.com"}'

Seems the GitHub Actions: checks-action is a good fix to solve your problem:

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@v1.1.1
      if: always()
      with:
        token: ${{ secrets.GITHUB_TOKEN }}
        name: Test XYZ
        conclusion: ${{ job.status }}
        output: |
          {"summary":${{ steps.test.outputs.summary }}}

The output field could help:

output:
Supports the following properties:

summary: Required, summary of your check
text_description: Optional, a text description of your annotation (if any)

Link to Marketplace

Related