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

ci: allow forks to use secrets under aproval #518

Merged
merged 1 commit into from
Feb 27, 2025

Conversation

smoya
Copy link
Contributor

@smoya smoya commented Feb 27, 2025

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 to on: 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 to on: pull_request_targeton 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

@smoya smoya requested a review from a team as a code owner February 27, 2025 11:02
adolsalamanca

This comment was marked as outdated.

@smoya smoya force-pushed the sergio-aprove-secrets-in-forks branch from 820dfa1 to 2341fcf Compare February 27, 2025 11:38
@smoya smoya merged commit c86a175 into main Feb 27, 2025
1 check passed
@smoya smoya deleted the sergio-aprove-secrets-in-forks branch February 27, 2025 16:33
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

Successfully merging this pull request may close these issues.

3 participants