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

github-pr-review report permission error with corrent token #1010

Closed
trim21 opened this issue Aug 3, 2021 · 0 comments · Fixed by #1014
Closed

github-pr-review report permission error with corrent token #1010

trim21 opened this issue Aug 3, 2021 · 0 comments · Fixed by #1014

Comments

@trim21
Copy link
Contributor

trim21 commented Aug 3, 2021

I have a workflow with corrent Github API token

But I got the fallback result:

reviewdog: This GitHub token doesn't have write permission of Review API [1], 
so reviewdog will report results via logging command [2] and create annotations similar to

I have tried that this token has all the permission github needed when creating a pull request PR:

name: Lint Other Language

on:
  push:
    branches:
      - master
    paths:
      - "**.md"
      - "**.yaml"
      - "**.yml"
      - "**.html"
      - "**.json"
  pull_request_target:
    types: [opened, synchronize, reopened]
    branches:
      - master
      - test
    paths:
      - "**.md"
      - "**.yaml"
      - "**.yml"
      - "**.html"
      - "**.json"

...

      - name: try review api
        run: |
          curl -X POST \
            -H "Authorization: token ${REVIEWDOG_GITHUB_API_TOKEN}" \
            -H "Accept: application/vnd.github.v3+json" \
            URL \
            -d '{"body": "a review", "event": "COMMENT"}'
        env:
          REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.REVIEWDOG_TOKEN }}

      - run: git diff --exit-code

      - name: create review
        if: ${{ failure() }}
        run: |
          TMPFILE=$(mktemp)
          git diff >"${TMPFILE}"
          git reset --hard HEAD
          reviewdog -f=diff -f.diff.strip=1 -reporter=github-pr-review -tee < "${TMPFILE}"
          exit 1
        env:
          REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.REVIEWDOG_TOKEN }}
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

Successfully merging a pull request may close this issue.

1 participant