Custom "details" link in the github pr checks

1.7k Views Asked by At

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

There are 3 best solutions below

1
On BEST ANSWER

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/[email protected]
      id: test
    - uses: LouisBrunner/[email protected]
      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

0
On

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"}'
0
On

I believe they are coming from an external source and not GitHub Actions. If you are using GitHub Actions I do not think this is feasible.

You can however create a deployment environment and add the url parameter to it so you can click the "View Deployment" button.

https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#using-an-environment