Skip to content

Commit 8358531

Browse files
committed
wip
1 parent 75f60f2 commit 8358531

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

.github/workflows/update-swift-version.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ jobs:
3636
set -ex
3737
3838
git fetch
39-
BRANCH=ci/update-swift-version
40-
if git ls-remote --exit-code --heads origin "$BRANCH"; then
41-
git checkout -b "$BRANCH" --track "origin/$BRANCH"
39+
branch=$branch
40+
if git ls-remote --exit-code --heads origin "$branch"; then
41+
git checkout -b "$branch" --track "origin/$branch"
4242
else
43-
git checkout -b "$BRANCH"
43+
git checkout -b "$branch"
4444
fi
4545
4646
UNAME=$(uname -m)
@@ -56,13 +56,17 @@ jobs:
5656
latest=$(swiftly list-available main-snapshot | grep main-snapshot | head -n 1 | awk '{print $1}')
5757
echo -n "$latest" > .swift-version
5858
echo "version=$latest" >> "$GITHUB_OUTPUT"
59+
if [[ -z "$(git status --porcelain .swift-version)" ]]; then
60+
echo "Already set to the latest Swift release, exiting."
61+
exit 0
62+
fi
5963
6064
git add .swift-version
6165
git commit -m "Update Swift version to $latest"
62-
git push -u origin "$BRANCH"
66+
git push -u origin "$branch"
6367
6468
gh auth setup-git
65-
pr=$(gh pr list --head ci/update-swift-version --state open --json number --jq '.[0].number')
69+
pr=$(gh pr list --head "$branch" --state open --json number --jq '.[0].number')
6670
6771
title="ci: update Swift version to $latest"
6872
body="Updates the \`.swift-version\` file to Swift `$latest`.
@@ -73,7 +77,7 @@ jobs:
7377
gh pr create \
7478
--title "$title" \
7579
--body "$body" \
76-
--head "ci/update-swift-version" \
80+
--head "$branch" \
7781
--base "main"
7882
else
7983
echo "PR already exists: #$pr"

0 commit comments

Comments
 (0)