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

Reviewdog crashes with error: reviewdog: environment variable $REVIEWDOG_GITHUB_API_TOKEN is not set #556

Closed
MarvinJWendt opened this issue Jun 30, 2023 · 3 comments

Comments

@MarvinJWendt
Copy link

MarvinJWendt commented Jun 30, 2023

Reviewdog crashes with error: reviewdog: environment variable $REVIEWDOG_GITHUB_API_TOKEN is not set

Workflow:

name: Code analysis

on: [pull_request]

jobs:
  golangci-lint:
    runs-on: ubuntu-latest
    steps:
      - name: Check out code into the Go module directory
        uses: actions/checkout@v3
        with:
          fetch-depth: 0
      - name: Linting with golangci-lint
        uses: reviewdog/action-golangci-lint@v2
        with:
          github_token: ${{ secrets.ACCESS_TOKEN }}
          reporter: github-pr-review
        env:
          REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.ACCESS_TOKEN }}

Action log: https://github.com/pterm/pterm/actions/runs/5423793140/jobs/9862524142?pr=507

@MarvinJWendt MarvinJWendt changed the title Reviewdog crashes: reviewdog: environment variable $REVIEWDOG_GITHUB_API_TOKEN is not set reviewdog: environment variable $REVIEWDOG_GITHUB_API_TOKEN is not set Jun 30, 2023
@MarvinJWendt MarvinJWendt changed the title reviewdog: environment variable $REVIEWDOG_GITHUB_API_TOKEN is not set Reviewdog crashes with error: reviewdog: environment variable $REVIEWDOG_GITHUB_API_TOKEN is not set Jun 30, 2023
@shogo82148
Copy link
Contributor

It is the specification of GitHub Actions. Not an issue of the action.

Your workflow is triggered from the pull request pterm/pterm#507.
The document says that these workflows don't receive any secrets.

https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#accessing-secrets

Workflows triggered using the pull_request event have read-only permissions and have no access to secrets.

Actually, your REVIEWDOG_GITHUB_API_TOKEN is empty.

https://github.com/pterm/pterm/actions/runs/5423793140/jobs/9862524142?pr=507#step:3:13

image

@MarvinJWendt
Copy link
Author

Huh, that's interesting. How is this action supposed to work then with the GitHub PR review reporter, as it needs a token?

@shogo82148
Copy link
Contributor

see https://github.com/reviewdog/reviewdog#graceful-degradation-for-pull-requests-from-forked-repositories please

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

2 participants