Skip to content

bug: license-check fails to create PR comments due to insufficient GITHUB_TOKEN permissions #1284

Description

@Alanxtl

Description

The license check workflow uses license-eye with:

header:
  comment: on-failure

When an invalid license header is detected, license-eye tries to create a pull request review/comment. However, the workflow does not declare the required GITHUB_TOKEN permissions, resulting in:

WARNING Failed to create review comment: 403 Resource not accessible by integration
WARNING Failed to create review comments: 403 Resource not accessible by integration

The relevant workflow is:

.github/workflows/license-check.yml

Suggested solutions:

Option 1: Grant the minimum required permissions

permissions:
  contents: read
  pull-requests: write
  issues: write

pull-requests: write is required for creating PR reviews, while issues: write may be required by the fallback plain-comment mechanism.

Option 2: Disable automatic PR comments

If automatic comments are not required, change the configuration to:

header:
  comment: never

The workflow should choose one of these approaches to avoid the misleading permission warnings. Note that workflows triggered by fork pull requests may still receive a read-only GITHUB_TOKEN.

References:

Are you willing to submit a PR to fix this bug?

  • Yes, I would like to submit a PR.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status
Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions