@@ -65,11 +65,50 @@ jobs:
6565 - name : Create Pull Request
6666 uses : peter-evans/create-pull-request@v7
6767 with :
68- commit-message : Update Kani metrics
6968 title : ' Update subtree/library'
7069 body : |
7170 This is an automated PR to update the subtree/library branch to the changes
7271 up to and including ${{ env.COMMIT_HASH }} of ${{ env.TOOLCHAIN_DATE }}.
7372 branch : update-subtree/library
7473 delete-branch : true
7574 base : subtree/library
75+
76+ - name : Merge subtree/library changes
77+ run : |
78+ SYNC_BRANCH="sync-$TOOLCHAIN_DATE"
79+ git checkout -t -b ${SYNC_BRANCH} origin/main
80+ git submodule update --init
81+
82+ # This command may fail, which will require human intervention.
83+ if ! git subtree merge --prefix=library subtree/library --squash; then
84+ echo "MERGE_CONFLICTS=yes" >> $GITHUB_ENV
85+ git commit -a -m "Merge from $COMMIT_HASH with conflicts"
86+ else
87+ echo "MERGE_CONFLICTS=no" >> $GITHUB_ENV
88+ fi
89+
90+ sed -i "s/^channel = \"nightly-.*\"/channel = \"${TOOLCHAIN_DATE}\"/" rust-toolchain.toml
91+ git commit "Update toolchain to ${TOOLCHAIN_DATE}" rust-toolchain.toml
92+
93+ - name : Create Pull Request without conflicts
94+ if : ${{ env.MERGE_CONFLICTS == 'no' }}
95+ uses : peter-evans/create-pull-request@v7
96+ with :
97+ title : ' Merge subtree update'
98+ body : |
99+ This is an automated PR to merge library subtree updates
100+ up to and including ${{ env.COMMIT_HASH }} of ${{ env.TOOLCHAIN_DATE }}
101+ into main. This is a clean merge, no conflicts were detected.
102+ delete-branch : true
103+
104+ - name : Create Pull Request with conflicts
105+ if : ${{ env.MERGE_CONFLICTS == 'yes' }}
106+ uses : peter-evans/create-pull-request@v7
107+ with :
108+ title : ' Merge subtree update'
109+ body : |
110+ This is an automated PR to merge library subtree updates
111+ up to and including ${{ env.COMMIT_HASH }} of ${{ env.TOOLCHAIN_DATE }}
112+ into main. `git merge` resulted in conflicts, which require manual resolution.
113+ Files were commited with merge conflict markers.
114+ delete-branch : true
0 commit comments