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

GitHub token permissions should be checked prior to packaging #154

Open
Meorawr opened this issue Feb 26, 2023 · 5 comments
Open

GitHub token permissions should be checked prior to packaging #154

Meorawr opened this issue Feb 26, 2023 · 5 comments

Comments

@Meorawr
Copy link
Contributor

Meorawr commented Feb 26, 2023

Given the recent confusion in both #152 and #153, it feels like it would be sensible for the packager to check if the supplied GITHUB_OAUTH token (if present) actually has the necessary permissions to publish a release to the repository before packaging - if it doesn't, then it can spit out a reasonably clear error about what needs to be done to fix it.

Currently if the token lacks permissions you'll get an "Resource not available to integration" error at the point where the package is submitted for publishing - which occurs after it's already been published elsewhere - so fixing the issue after it's occurred is a bit annoying.

@Nevcairiel
Copy link
Member

Personally, I think it should spit out a warning, but then just skip GitHub, and still upload to whatever else its going to upload to.

@Meorawr
Copy link
Contributor Author

Meorawr commented Feb 27, 2023

My concern with it just being a warning would be that people likely aren't routinely checking their workflow outputs - so in effect it'll just have silently failed to upload to GitHub until the point they find out that the last n tags weren't published as releases.

@Nevcairiel
Copy link
Member

Its likely only going to affect new projects, in which case you should check your workflow. What if I don't want my token to have write access?

@Meorawr
Copy link
Contributor Author

Meorawr commented Feb 27, 2023

The answer I would have given to that would be the same advice I'd give to someone who didn't want to upload to any other platform - simply don't provide the token.

Unfortunately there's a sole usage of $github_token in changelog generation for... something, so that would probably need thinking about.

@nebularg
Copy link
Member

nebularg commented Feb 27, 2023

Its likely only going to affect new projects, in which case you should check your workflow. What if I don't want my token to have write access?

The github token is for publishing a release, for what reason would you add the token to the packager environment if it was read-only?

Unfortunately there's a sole usage of $github_token in changelog generation for... something, so that would probably need thinking about.

It is used to print the "previous releases" github link, I suppose I could just check the remotes instead of being lazy, so not much of an issue there. (would also "fix" a use case for a r/o token)

Personally, I think it should spit out a warning, but then just skip GitHub, and still upload to whatever else its going to upload to.

Being the last task the script does, checking then erroring would still effectively do this. So the error would basically be switching from "Resource not available to integration" to something custom

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

3 participants