-
Notifications
You must be signed in to change notification settings - Fork 1
Module ‐ Patch
Stéphane Brunner edited this page Jun 4, 2025
·
4 revisions
When a workflow failed, see if there is an attached artifact with a name that ends with .patch, and try to apply it on the branch, in a new commit.
This module automates the process of applying patch files generated by CI workflows. When a workflow fails and produces a .patch artifact, the module will:
- Download the
.patchartifact from the failed workflow run. - Attempt to apply the patch to the current branch.
- Commit the changes with a message based on the patch filename or a default message.
- Push the commit to the pull request branch, allowing the workflow to re-run with the proposed fix.
This helps contributors and maintainers quickly test and apply automated fixes suggested by CI jobs.
on:
pull-request:
jobs:
<name>:
steps:
...
- run: git diff --exit-code --patch > diff.patch
- uses: actions/upload-artifact@v4
with:
name: <commit_message>.patch
path: diff.patch
retention-days: 1
if: failure()- Ensure the workflow produces a valid
.patchfile as an artifact on failure. - The module will only attempt to apply patches if the artifact is present and can be cleanly applied.
- Review the resulting commit to ensure the patch does not introduce unintended changes.