Secrets to forked PRs #837
-
Hello, I am using this action to run some unit tests that require AWS creds on a public repo. I am using these by setting secrets in the repository settings. However, I notice that the secrets are not being read when a PR is opened by external contributors. I have "Approve and run" set up for any external contributions, but enabling that does not help either. Maybe this is not the right channel and not really specific to AWS credentials, but the question is specific to how secrets are dealt with in GHA. I have read multiple articles talking about this, but have not gotten to a concrete solution. Anybody successful in setting GHA for forked PRs? Note, I have gone through |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
Hey @disa6302, This setup you're describing sounds like it would be a massive security risk. I'm not sure what your exact use case is or if you have other security measures in place, but I would recommend against allowing forked PRs to run code in an environment with your AWS credentials unless other measures are in place. That said, you're seeing the correct behavior when workflows ran on
|
Beta Was this translation helpful? Give feedback.
-
Thank you for your response and the article! Might be a stupid question, but I am unable to think of scenarios For your knowledge, the CI does not actually generate or publish any artifacts, but the CI only builds the unit test targets and tests out different cmake build options and runs unit tests, hence, it is important that the CI runs on forked PRs because we need unit tests to pass before it can be merged. The repo does have the approve and run workflow and I do see that the CI run can be controlled with labels as per the article. So that is great! |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
No worries for asking questions @disa6302,
I didn't directly answer how you can use
pull_request_target
because I don't want to come across like I'm recommending this unless you know exactly what you're doing. The article explains how you can usepull_request_target
to run the submitter code while having access to secrets in your repository. What you need to do is check out the pull request head, and then you can do whatever you'd likeThere are o…