-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(repo): ensure self mutation updates branch as well (#3922)
Pull requests do not actually run workflows on the head of a given branch, it uses the merge commit between that head and the target head (e.g. `main`) This means that when mutation patches are generated, they assume they're operating on the merge commit. This PR makes that assumption true when applying patches by also updating the branch itself. adding do-not-merge to test, but feel free to review. *By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*.
- Loading branch information
1 parent
f6a363a
commit 116ee64
Showing
3 changed files
with
49 additions
and
14 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,11 +70,35 @@ jobs: | |
if: steps.download-artifacts.outputs.found_artifact == 'true' | ||
name: Apply downloaded pathes | ||
working-directory: repo | ||
env: | ||
HEAD_REF: ${{ github.event.workflow_run.head_branch }} | ||
run: | | ||
git config user.name "monada-bot[bot]" | ||
git config user.email "[email protected]" | ||
# if ../patches/update.diff/update.diff exists, apply it first | ||
UPDATE_PATCH_FILE="../patches/update.diff/update.diff" | ||
if [ -f $UPDATE_PATCH_FILE ]; then | ||
echo "Updating branch" | ||
git apply --binary $UPDATE_PATCH_FILE | ||
if [ $? -eq 0 ]; then | ||
git add --all | ||
git commit -s -m "Merge branch 'main' into $HEAD_REF" | ||
echo "Patch applied successfully" | ||
rm $UPDATE_PATCH_FILE | ||
else | ||
echo "Patch failed to apply" | ||
cat $UPDATE_PATCH_FILE | ||
exit 1 | ||
fi | ||
fi | ||
for f in $(find ../patches/*.diff/*.diff); do | ||
echo "Applying $f" | ||
git apply --binary $f | ||
if [ $? -eq 0 ]; then | ||
git add --all | ||
git commit -s -m "chore: self mutation ($f)" | ||
echo "Patch applied successfully" | ||
rm $f | ||
else | ||
|
@@ -84,16 +108,6 @@ jobs: | |
fi | ||
done | ||
- name: Push changes | ||
if: steps.download-artifacts.outputs.found_artifact == 'true' | ||
working-directory: repo | ||
env: | ||
HEAD_REF: ${{ github.event.workflow_run.head_branch }} | ||
run: | | ||
git config user.name "monada-bot[bot]" | ||
git config user.email "[email protected]" | ||
git add --all | ||
git commit -s -m "chore: self mutation" | ||
git push origin HEAD:$HEAD_REF | ||
- name: Add label to block auto merge | ||
|
This file contains 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