octokit / request-action

A GitHub Action to send arbitrary requests to GitHub's REST API
https://github.com/marketplace/actions/GitHub-API-Request
MIT License
362 stars 48 forks source link

[Question]: How to use this action with `POST /repos/{owner}/{repo}/check-runs` #291

Closed mostlycloudysky closed 3 weeks ago

mostlycloudysky commented 5 months ago

What happened?

I have gone through the readme example and it looks like, check API does not work directly with the special GitHub Action Secret and it needs to be done through Github APP integration. Could you please clarify ?

jobs:
  create-file:
    runs-on: ubuntu-latest
    steps:
      # Create check run
      - uses: octokit/request-action@v2.x
        id: create_check_run
        with:
          route: POST /repos/{owner}/{repo}/check-runs
          owner: octokit
          repo: request-action
          name: "Test check run"
          head_sha: ${{ github.sha }}
          output: | # The | is significant!
            title: Test check run title
            summary: A summary of the test check run
            images:
              - alt: Test image
                image_url: https://octodex.github.com/images/jetpacktocat.png
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Versions

request-action@v2.x

Relevant log output

No response

Code of Conduct

github-actions[bot] commented 5 months ago

๐Ÿ‘‹ Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labled with Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! ๐Ÿš€

chipairon commented 3 weeks ago

If it helps someone, I managed to use the "checks" API providing a Github APP token as hinted by the OP using https://github.com/tibdex/github-app-token

gr2m commented 3 weeks ago

We recommend using https://github.com/actions/create-github-app-token, but either action will work ๐Ÿ‘

So octokit/request-action itself works, but it might fail due to limited permissions. Try to add checks: write, see https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs#defining-access-for-the-github_token-scopes

gr2m commented 3 weeks ago

I'm going to close the issue since there is nothing actionable for the @octokit team to do, but feel free to ask follow up questions