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

Set default GitHub token #89

Merged
merged 3 commits into from
Nov 17, 2022
Merged

Conversation

laughedelic
Copy link
Contributor

secrets.GITHUB_TOKEN can't be used as a default input because secrets context is not available in that part of the manifest, but github context is available, so it's possible to set a default token.

@bendrucker
Copy link
Member

Nice, I've added a corresponding README update.

But on second thought, I'm thinking this is not only a breaking change, but also possibly a permanent one for a very small number of users.

When running via GitHub Enterprise Server, it seems likely that the job tokens injected into Actions jobs are only accepted by that GHES instance, and not github.com. This would make it a breaking change.

Then the question becomes, for GHES users, does setting an empty string for the token unset the default? It does sound like that's the case:

actions/runner#924 (comment)

As long as that's true I'll merge and cut a major release for this. But would appreciate a sanity check on my thinking.

README.md Outdated Show resolved Hide resolved
@laughedelic
Copy link
Contributor Author

Interesting, I didn't know that it would break it for GHES. It's a pretty common pattern in GitHub actions as far as I can see.

But is the GitHub token actually needed? If it's only to obtain release data from the TFLint repository, I think it should be pretty hard to hit the API rate limit 🤔

@bendrucker
Copy link
Member

I don't use GHES, never have. Just trying to properly scrutinize this. If you believe this is commonly implemented, share links so we can vet the approach. This is an edge case but I'm sure someone's encountered/considered it before.

Unauthenticated requests are rate limited by IP. On a shared host, you can be rate limited because you are making lots of requests or because another user is. In either case you are more susceptible to rate limiting the more requests you make but in the latter it's possible to be rate limited on a job that makes only one request.

@bendrucker
Copy link
Member

Thanks for this, going with a major release based on my expectation that this might break when called from GitHub Enterprise Server. I'm thinking the ID tokens issued there aren't accepted on github.com.

@bendrucker bendrucker merged commit ba6bb29 into terraform-linters:master Nov 17, 2022
@laughedelic laughedelic deleted the patch-1 branch October 6, 2023 02:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants