ci: allow forks to use secrets under aproval #518
Merged
+11
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
PR's made from forks can't succeed on CI because their actions doesn't have access to the GH secrets stored at repository level. That's solved by changing the
on: pull_request
toon: pull_request_target
(See docs), however that would allow any PR on any fork to use the secrets without previous validation.Description
This PR changes the
on: pull_request
toon: pull_request_target
on the CI workflow and additionally adds a check for forcing external contributions (PR's made from forks) to be manually approved by @timescale/ts-vector team before running CI.In that way, it is the responsibility of @timescalde/ts-vector to carefully check any PR doesn't do any unexpected thing with secrets.
The work is based on this article: https://datachain.ai/blog/testing-external-contributions-using-github-actions-secrets
I decided to keep the approach on having two GH environments and always run in one of them instead of only setting the environment when an external contribution happens.
The reason is that in this way, we could add, at any moment, high privileged secrets in such environment without "leaking" them to forks.
At this moment, there are no specific secrets per environment, just using the ones set as global repository secrets