Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Details link doesn't seem to work #21

Closed
stereobooster opened this issue May 26, 2021 · 6 comments
Closed

Details link doesn't seem to work #21

stereobooster opened this issue May 26, 2021 · 6 comments

Comments

@stereobooster
Copy link

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?

@stereobooster
Copy link
Author

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

@mayank99
Copy link

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

@stereobooster
Copy link
Author

@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.

@stereobooster
Copy link
Author

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/[email protected]
      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

@williamfgc
Copy link

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

@stereobooster
Copy link
Author

    - 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants