LouisBrunner/checks-action

Details link doesn't seem to work

Closed this issue · 6 comments

Hi! First of all thank you for creating this action.

I'm trying to create check similar to Netlify

Screenshot 2021-05-26 at 22 09 09

When I click details it opens tab with deployment preview of website.

I hoped that details_url of this action would do the trick, but instead details link opens ...runs/2678826558?check_suite_focus=true. By any chance do you know what can be the issue?

Based on this doc https://docs.github.com/en/rest/reference/checks#create-a-check-run

details_url - The URL of the integrator's site that has the full details of the check. If the integrator does not provide this, then the homepage of the GitHub app is used.

conclusion - Required if you provide completed_at or a status of completed. The final conclusion of the check. Can be one of action_required, cancelled, failure, neutral, success, skipped, stale, or timed_out. When the conclusion is action_required, additional details should be provided on the site specified by details_url. Note: Providing conclusion will automatically set the status parameter to completed. You cannot change a check run conclusion to stale, only GitHub can set this.

I don't think that action_url suppose to override details_url, but it is hard to be sure

Hi @stereobooster,

I had the exact same problem and spent quite a while digging into this. I believe #18 is a duplicate of this issue.

In the end, I ended up just creating a "Status" instead of "Check". The target_url param works great! See https://docs.github.com/en/rest/reference/repos#create-a-commit-status

@mayank99 thanks a lot, yes it seems what I'm looking for. I will try it and report back and close the ticket.

PS: I'm sorry for opening duplicate ticket.

I tried following code, but it doesn't seem to work

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2

    - name: Set preview status
      uses: actions/github-script@v4.0.2
      with:
        github-token: ${{secrets.GITHUB_TOKEN}}
        script: |
              const { payload } = context;
              const sha = payload.pull_request && payload.pull_request.head
                  ? payload.pull_request.head.sha
                  : context.sha;
              await github.repos.createStatus({
                ...context.repo,
                sha,
                state: "success",
                target_url: `...`,
                description: "Preview is ready!",
              });

actions/github-script#148

@stereobooster I followed @mayank99 suggestion and used the following action to set up a status check and a target_url. It worked as expected.

    - name: Set preview status
      uses: actions/github-script@v4
      with:
        github-token: ${{secrets.GITHUB_TOKEN}}
        script: |
              await github.repos.createCommitStatus({
                ...context.repo,
                sha: context.sha,
                state: "success",
                target_url: `...`,
                description: "Preview is ready!",
                context: "✨ Preview"
              });

this what I end up doing