Enable fork-based PRs to use fix workflows#157
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the fix workflows (clang-tidy, clang-format, cmake-format, and python-fix) to enable fork-based pull requests to use automated fix functionality. Previously, the workflows were restricted to collaborators and owners via author_association checks. Now, the workflows rely on GitHub's "require approval for first-time contributors" setting for security and can either commit fixes directly (if the PR author has enabled "allow edits from maintainers") or provide a patch file for manual application.
Key changes:
- Introduces a reusable composite action
handle-fix-committhat encapsulates the commit/patch logic - Removes
author_associationbarriers from all fix workflow triggers - Adds logic to check the
maintainer_can_modifyproperty on PRs to determine if direct commits are possible - Implements a fallback mechanism that creates patch files and posts instructions when direct commits aren't allowed
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
.github/actions/handle-fix-commit/action.yaml |
New reusable composite action that checks for changes, attempts to commit if possible (based on fork status and maintainer edit permissions), or creates a patch artifact with instructions |
.github/workflows/python-fix.yaml |
Refactored to use new handle-fix-commit action; removed author_association check; restructured with separate parse-command and apply_fixes jobs |
.github/workflows/cmake-format-fix.yaml |
Refactored to use new handle-fix-commit action; removed author_association check; simplified commit handling |
.github/workflows/clang-tidy-fix.yaml |
Refactored to use new handle-fix-commit action; removed author_association check; streamlined fix application process |
.github/workflows/clang-format-fix.yaml |
Refactored to use new handle-fix-commit action; removed author_association check; consolidated commit logic |
Comments suppressed due to low confidence (2)
.github/workflows/python-fix.yaml:39
- The
apply_fixesjob has a redundantGet PR Infostep (lines 37-39) that is not used. The job already receives the PR information from theparse-commandjob's outputs (lines 44-45 useneeds.parse-command.outputs.*). This duplicate step should be removed.
- name: Get PR Info
id: get_pr
uses: Framework-R-D/phlex/.github/actions/get-pr-info@main
.github/workflows/python-fix.yaml:39
- In the
python-fix.yamlworkflow, theapply_fixesjob still has a duplicateGet PR Infostep (lines 37-39) even though it receives the PR info from theparse-commandjob's outputs. This step is redundant and should be removed since the outputs fromparse-commandare already being used (lines 44-45).
- name: Get PR Info
id: get_pr
uses: Framework-R-D/phlex/.github/actions/get-pr-info@main
This commit refactors the "fix" workflows (`clang-tidy`, `clang-format`, `cmake-format`, and `python-fix`) to allow contributors from forked repositories to trigger them. Key changes: - A new reusable action, `handle-fix-commit`, is introduced to encapsulate the logic for either committing fixes directly or creating a patch file. - The workflows now check if the PR author has enabled "allow edits from maintainers." If so, the fixes are committed to their branch. - If edits are not allowed, a patch file is created and uploaded as an artifact, and a comment is posted on the PR with instructions on how to apply it. - The `author_association` check has been removed from the workflows, relying on GitHub's "require approval for first-time contributors" setting for security. - The `python-fix.yaml` workflow has been corrected to include the necessary `pull-requests: write` permission.
c46ddb6 to
ed3c0a3
Compare
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
knoepfel
approved these changes
Dec 5, 2025
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.
This commit refactors the "fix" workflows (
clang-tidy,clang-format,cmake-format, andpython-fix) to allow contributors from forked repositories to trigger them.Key changes:
handle-fix-commit, is introduced to encapsulate the logic for either committing fixes directly or creating a patch file.author_associationcheck has been removed from the workflows, relying on GitHub's "require approval for first-time contributors" setting for security.python-fix.yamlworkflow has been corrected to include the necessarypull-requests: writepermission.