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

Give a better error than "Resource not accessible by integration" when permissions lacking #368

Open
JoshuaKGoldberg opened this issue May 21, 2023 · 3 comments · May be fixed by #374
Open
Labels
enhancement New feature or request

Comments

@JoshuaKGoldberg
Copy link
Contributor

Is your feature request related to a problem? Please describe.

When a repository's actions/job/workflow aren/isn't configured with enough permissions, mtfoley/pr-compliance-action outputs very little information:

Error: This PR's title should conform to specification at https://conventionalcommits.org/
Error: Resource not accessible by integration

JoshuaKGoldberg/template-typescript-node-package/actions/runs/5032810384/jobs/9026669253?pr=456

Per JoshuaKGoldberg/create-typescript-app#457, it looks like it's not always possible for repositories to be configured properly right now. Specifically - forks of public repos are just... not able to give write token permissions to actions run in PRs? (please correct me if I'm wrong!)

Describe the solution you'd like

Either way, how about one or (my preference) both of:

  • Saying what comment would be posted in the action's output before trying to post the comment
  • Outputting a custom warning line expliaining why a comment wasn't posted in this known case?
@mtfoley
Copy link
Owner

mtfoley commented Aug 23, 2023

Since we have almost no error handling other than one big try/catch block, I'd suggest a solution where each octokit call has its own error handling, so we can do more helpful suggestions. I've been writing in Golang primarily at work lately (handle ALL the errors), so I'm looking at this code like "who wrote this?".

Perhaps there's a different route where https://github.com/actions/core or similar offers a way to verify the workflow is getting the permissions it asked for 🤷

EDIT: and yes @JoshuaKGoldberg we could totally add an action output that reflects the code comment the action would/does try to apply.

@JoshuaKGoldberg
Copy link
Contributor Author

Golang

Yessssssss let's return all the Errors!!

@mtfoley mtfoley linked a pull request Aug 24, 2023 that will close this issue
12 tasks
@mtfoley
Copy link
Owner

mtfoley commented Aug 24, 2023

Golang

Yessssssss let's return all the Errors!!

I started a new PR for this one. I haven't tried it anywhere yet, but you're welcome to give it a try if there's a reproduction you already have going.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants