Replies: 3 comments 3 replies
|
You’re not missing anything, this is intentional behavior by GitHub. Workflows triggered by Secrets are only exposed for trusted events, such as:
This is why some repositories appear to behave differently. In most cases, they are:
So what feels inconsistent is actually GitHub enforcing a strict security boundary between untrusted PR code and sensitive credentials. In short: nothing is broken, GitHub is doing this to keep your secrets safe, even if it feels a bit confusing at first 👍 |
|
GitHub doesn’t expose repository secrets to workflows triggered by pull_request events for security reasons even if the PR is from a branch inside the same repo. Only push events (and pull_request_target, with caution) can access secrets. That’s why your workflow can read secrets on push, but not on pull requests. If you really need secret access during PRs, you’d need to switch to pull_request_target, but be careful because it runs in the context of the base branch and can be risky if contributors can modify the workflow. |
|
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Uh oh!
There was an error while loading. Please reload this page.
Why are you starting this discussion?
Question
What GitHub Actions topic or product is this about?
Workflow Configuration
Discussion Details
Hello,
I've seen some repositories that use repo secrets to publish packages to NuGet, and where the secrets cannot be read from pull requests, both forks but also PR's between 2 branches in the repo (like from 'dev' to 'main') but the action is able to read the secrets on push.
This seems odd to me as I can't seem to replicate the functionality.
Example yml:
What am I missing?
All reactions