ataylorme / eslint-annotate-action

A GitHub action that takes ESLint results from a JSON file and adds them as annotated pull request comments
MIT License
88 stars 32 forks source link

GHE Bad Credentials #48

Closed cgatian closed 2 months ago

cgatian commented 1 year ago

On GHE 3.5 and experiencing the following error:

2022-09-23T13:58:22.6907309Z ℹ  info      1 ESLint error(s) and 1 ESLint warning(s) found
2022-09-23T13:58:22.8592709Z ✖  fatal     Bad credentials

Other GitHub Actions that take the GITHUB_TOKEN are working. Perhaps the token lacks the specific permission the action needs?

Here are my token permissions:

2022-09-23T13:55:08.3191335Z ##[group]GITHUB_TOKEN Permissions
2022-09-23T13:55:08.3192293Z Actions: write
2022-09-23T13:55:08.3192762Z Checks: write
2022-09-23T13:55:08.3193288Z Contents: write
2022-09-23T13:55:08.3193778Z Deployments: write
2022-09-23T13:55:08.3194267Z Discussions: write
2022-09-23T13:55:08.3194745Z Issues: write
2022-09-23T13:55:08.3195289Z Metadata: read
2022-09-23T13:55:08.3195736Z Packages: write
2022-09-23T13:55:08.3196206Z Pages: write
2022-09-23T13:55:08.3196689Z PullRequests: write
2022-09-23T13:55:08.3197236Z RepositoryProjects: write
2022-09-23T13:55:08.3197813Z SecurityEvents: write
2022-09-23T13:55:08.3198309Z Statuses: write
2022-09-23T13:55:08.3198779Z ##[endgroup]

Maybe it has something to do with setting antiope preview? Looks like that's been merged into the official for some time now.

https://github.com/ataylorme/eslint-annotate-action/blob/v2/src/constants.ts#L18

cgatian commented 1 year ago

According to the Octokit docs, checks:write is required. 🤷

cgatian commented 1 year ago

Disabled only-pr-files and same results.

ataylorme commented 1 year ago

I do think this is a permission error though I don't have anything on GitHub Enterprise to test.

Maybe there is an enterprise setting/restriction not allowing checks:write on GITHUB_TOKEN

I've seen a similar error when the action runs on pull requests from a fork and lack write permission

ataylorme commented 2 months ago

@cgatian not sure if you are still interested in self-hosted GitHub Enterprise support. If so, 3.0.0 has been released. I welcome pull requests to the v3 branch if you want to try and add support.

ataylorme commented 2 months ago

Closing as a duplicate of #69. Even though this PR came first that one has a more appropriate title in that GHE support would be a new feature