58
58
echo "NEXT_TOOLCHAIN_DATE=${NEXT_TOOLCHAIN_DATE}" >> $GITHUB_ENV
59
59
echo "CURRENT_COMMIT_HASH=${CURRENT_COMMIT_HASH}" >> $GITHUB_ENV
60
60
echo "NEXT_COMMIT_HASH=${NEXT_COMMIT_HASH}" >> $GITHUB_ENV
61
+ KANI_COMMIT_HASH=$(git -C kani-tmp rev-parse HEAD)
62
+ echo "KANI_COMMIT_HASH=${KANI_COMMIT_HASH}" >> $GITHUB_ENV
63
+
64
+ - name : Check for existing pull requests
65
+ run : |
66
+ cd verify-rust-std
67
+ if gh pr list --json title --jq '.[] | select(.title | startswith("Update subtree/library to")) | .title' | grep -q .; then
68
+ echo "SUBTREE_PR_EXISTS=yes" >> $GITHUB_ENV
69
+ else
70
+ echo "SUBTREE_PR_EXISTS=no" >> $GITHUB_ENV
71
+ fi
72
+ if gh pr list --json title --jq '.[] | select(.title | startswith("Merge subtree update for toolchain nightly-")) | .title' | grep -q .; then
73
+ echo "MERGE_PR_EXISTS=yes" >> $GITHUB_ENV
74
+ else
75
+ echo "MERGE_PR_EXISTS=no" >> $GITHUB_ENV
76
+ fi
77
+ env :
78
+ GH_TOKEN : ${{ github.token }}
61
79
62
80
- name : Update subtree/library locally
81
+ if : ${{ env.SUBTREE_PR_EXISTS == 'no' }}
63
82
run : |
64
83
cd rust-tmp
65
84
77
96
git remote add rust-filtered ../rust-tmp/
78
97
git fetch rust-filtered
79
98
git checkout -b subtree/library rust-filtered/subtree/library
99
+ # The filter-subtree operation adds an extraneous `library/` folder containing the submodules
100
+ # (c.f. https://github.com/model-checking/verify-rust-std/issues/249), so remove that before committing.
101
+ rm -rf library
80
102
SUBTREE_HEAD_MSG=$(git log --format=%s -n 1 origin/subtree/library)
81
103
UPSTREAM_FROM=$(git log --grep="${SUBTREE_HEAD_MSG}" -n 1 --format=%H rust-filtered/subtree/library)
82
104
UPSTREAM_HEAD=$(git log --format=%H -n 1 rust-filtered/subtree/library)
@@ -89,22 +111,23 @@ jobs:
89
111
echo "MERGE_CONFLICTS=maybe" >> $GITHUB_ENV
90
112
fi
91
113
92
- - name : Create Pull Request
93
- if : ${{ env.MERGE_CONFLICTS != 'noop' }}
114
+ - name : Create Pull Request to update subtree/library
115
+ if : ${{ env.MERGE_CONFLICTS != 'noop' && env.SUBTREE_PR_EXISTS == 'no' }}
94
116
uses : peter-evans/create-pull-request@v7
95
117
with :
96
118
title : ' Update subtree/library to ${{ env.NEXT_TOOLCHAIN_DATE }}'
97
119
body : |
98
120
This is an automated PR to update the subtree/library branch to the changes
99
121
from ${{ env.CURRENT_TOOLCHAIN_DATE }} (${{ env.CURRENT_COMMIT_HASH }})
100
122
to ${{ env.NEXT_TOOLCHAIN_DATE }} (${{ env.NEXT_COMMIT_HASH }}), inclusive.
123
+ **Do not merge this PR using the merge queue. Instead, use the rebase strategy.**
101
124
branch : update-subtree/library
102
125
delete-branch : true
103
126
base : subtree/library
104
127
path : verify-rust-std
105
128
106
129
- name : Merge subtree/library changes
107
- if : ${{ env.MERGE_CONFLICTS != 'noop' }}
130
+ if : ${{ env.MERGE_CONFLICTS != 'noop' && env.MERGE_PR_EXISTS == 'no' }}
108
131
run : |
109
132
cd verify-rust-std
110
133
git checkout main
@@ -119,12 +142,15 @@ jobs:
119
142
echo "MERGE_CONFLICTS=no" >> $GITHUB_ENV
120
143
fi
121
144
122
- sed -i "s/^channel = \"nightly-.*\"/channel = \"${NEXT_TOOLCHAIN_DATE}\"/" rust-toolchain.toml
145
+ sed -i "s/^channel = \"nightly-.*\"/channel = \"nightly- ${NEXT_TOOLCHAIN_DATE}\"/" rust-toolchain.toml
123
146
git -c user.name=gitbot -c user.email=git@bot \
124
147
commit -m "Update toolchain to ${NEXT_TOOLCHAIN_DATE}" rust-toolchain.toml
125
-
148
+ # Update kani-version.toml with the new Kani commit hash
149
+ sed -i "s/commit = .*/commit = \"${KANI_COMMIT_HASH}\"/" tool_config/kani-version.toml
150
+ git -c user.name=gitbot -c user.email=git@bot \
151
+ commit -m "Update Kani version to ${KANI_COMMIT_HASH}" tool_config/kani-version.toml
126
152
- name : Create Pull Request without conflicts
127
- if : ${{ env.MERGE_CONFLICTS == 'no' }}
153
+ if : ${{ env.MERGE_CONFLICTS == 'no' && env.MERGE_PR_EXISTS == 'no' }}
128
154
uses : peter-evans/create-pull-request@v7
129
155
with :
130
156
title : ' Merge subtree update for toolchain nightly-${{ env.NEXT_TOOLCHAIN_DATE }}'
@@ -139,7 +165,7 @@ jobs:
139
165
path : verify-rust-std
140
166
141
167
- name : Create Pull Request with conflicts
142
- if : ${{ env.MERGE_CONFLICTS == 'yes' }}
168
+ if : ${{ env.MERGE_CONFLICTS == 'yes' && env.MERGE_PR_EXISTS == 'no' }}
143
169
uses : peter-evans/create-pull-request@v7
144
170
with :
145
171
title : ' Merge subtree update for toolchain nightly-${{ env.NEXT_TOOLCHAIN_DATE }}'
0 commit comments