action-eslint icon indicating copy to clipboard operation
action-eslint copied to clipboard

HttpError: Resource not accessible by integration

Open raineorshine opened this issue 4 years ago • 6 comments

An HttpError occurred when a PR was submitted. It did not cause the check to fail because it was an uncaught exception.

Screen Shot 2019-11-25 at 9 20 55 AM

See: https://github.com/cybersemics/em/pull/177/checks?check_run_id=319316407

raineorshine avatar Nov 25 '19 16:11 raineorshine

Here is where it errors:

    try {
        const { conclusion, output } = await eslint_cli_1.eslint(filesToLint);
        await octokit.checks.update({
            ...context.repo,
            check_run_id: checkId,
            completed_at: new Date().toISOString(),
            conclusion,
            output
        });
        if (conclusion === 'failure') {
            core.setFailed(`ESLint found some errors`);
        }
    }
    catch (error) {
        await octokit.checks.update({
            ...context.repo,
            check_run_id: checkId,
            conclusion: 'failure',
            completed_at: new Date().toISOString()
        });
        core.setFailed(error.message);
    }

https://github.com/tinovyatkin/action-eslint/blob/master/lib/main.js#L92

Presumably this should catch the error and fail the action, so I am not sure how the action is completing successfully.

It looks like an octokit authentication error of some kind, perhaps similar to this: https://github.community/t5/GitHub-API-Development-and/Resource-not-accessible-by-integration-when-requesting-GitHub/td-p/13829

I believe I have the repo-token set correctly in my workflow config.

raineorshine avatar Nov 30 '19 18:11 raineorshine

(unintentional close)

raineorshine avatar Nov 30 '19 18:11 raineorshine

This actually seems like what is happening. It does not have write permission on forks: https://github.com/actions/labeler/issues/12#issuecomment-549901347

raineorshine avatar Nov 30 '19 18:11 raineorshine

So, what is your preferred behavior in this case - shallow errors on not being able to do annotations?

tinovyatkin avatar Nov 30 '19 20:11 tinovyatkin

Yes, if I am understanding what you mean by shallow errors. I think until there is a better workaround for the permissions issue, the action should fail if there is an error. I will keep an eye out for forthcoming solution from the mentioned issue.

raineorshine avatar Nov 30 '19 21:11 raineorshine

Has anyone gotten this action to work when non-owners submit a pull request? I'm still having the same issue: https://github.com/cybersemics/em/pull/242/checks.

raineorshine avatar Dec 27 '19 20:12 raineorshine