fix: split build/comment workflows to fix fork PR permissions#48
Merged
RadicalMuffinMan merged 2 commits intoMoonfin-Client:masterfrom Mar 14, 2026
Merged
Conversation
The build workflow uses pull_request (read-only, safe for fork code). The comment workflow uses workflow_run (write access, never runs untrusted code — only reads the build-results artifact).
Contributor
Author
|
Tested in my Fork: enyineer#3 Workflow works like before, should now also work in this repo for Fork-PRs as soon as it's merged to master. |
RadicalMuffinMan
requested changes
Mar 13, 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.
Problem
The build workflow from PR #42 fails on fork PRs with:
See: Failed run on PR #43
This happens because
pull_requestevents from forks run with a read-onlyGITHUB_TOKEN. The workflow tries to post a PR comment (pull-requests: write), which is blocked by GitHub's security model for fork PRs — regardless of thepermissionsblock in the YAML.Fix
Split the workflow into two files:
build.ymlpull_requestbuild-resultsartifactcomment.ymlworkflow_runThis is the recommended secure pattern from GitHub Security Lab. The
comment.ymlworkflow runs in the base repo context with write access, but only reads trusted artifact data — it never executes untrusted code from the PR.Additional improvements included
set -o pipefailon build steps (preventsteefrom masking exit codes)