ci: fix workflows that always fail for fork PRs#5065
Open
jamescrosswell wants to merge 1 commit intomainfrom
Open
ci: fix workflows that always fail for fork PRs#5065jamescrosswell wants to merge 1 commit intomainfrom
jamescrosswell wants to merge 1 commit intomainfrom
Conversation
Two CI workflows failed whenever a PR came from a fork because the pull_request trigger runs in a sandboxed context with no write access and no secrets: - Changelog Preview: switched pull_request → pull_request_target so the workflow runs in the base repo context and can post PR comments. Also tightened permissions from contents:write to contents:read since the workflow only needs to write to pull-requests. - Format Code: pull_request_target cannot push to a fork branch anyway, so the fix is fork-aware logic in the commit step. For fork PRs, formatting issues fail the check with a clear message telling the contributor which dotnet format command to run locally. Internal PR behaviour (auto-commit and push) is unchanged. Warden was also listed as failing but is already resolved — warden.yml was removed because Warden is now a globally-enabled GitHub App with its own credentials, unaffected by fork PR restrictions. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5065 +/- ##
==========================================
+ Coverage 74.01% 74.13% +0.12%
==========================================
Files 499 499
Lines 18065 18066 +1
Branches 3518 3518
==========================================
+ Hits 13370 13393 +23
+ Misses 3836 3812 -24
- Partials 859 861 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
jamescrosswell
added a commit
that referenced
this pull request
Mar 26, 2026
jamescrosswell
added a commit
to jamescrosswell/sentry-dotnet
that referenced
this pull request
Mar 26, 2026
jamescrosswell
added a commit
to jamescrosswell/sentry-dotnet
that referenced
this pull request
Mar 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #5062:
Two CI workflows failed whenever a PR came from a fork because the pull_request trigger runs in a sandboxed context with no write access and no secrets:
Changelog Preview: switched pull_request → pull_request_target so the workflow runs in the base repo context and can post PR comments. Also tightened permissions from contents:write to contents:read since the workflow only needs to write to pull-requests.
Format Code: pull_request_target cannot push to a fork branch anyway, so the fix is fork-aware logic in the commit step. For fork PRs, formatting issues fail the check with a clear message telling the contributor which dotnet format command to run locally. Internal PR behaviour (auto-commit and push) is unchanged.
Warden was also failing but is already resolved — warden.yml was removed because Warden is now a globally-enabled GitHub App with its own credentials, unaffected by fork PR restrictions.
Testing
Tested here:
Pushed from my own private fork of the Sentry repo.