@@ -31,10 +31,14 @@ jobs:
3131 sudo apt-get install -y curl jq
3232
3333 - name : Create or update branch
34- id : latest
34+ id : update
3535 run : |
3636 BRANCH=ci/update-swift-version
37- git checkout -B "$BRANCH"
37+ if git show-ref --verify --quiet "refs/heads/$BRANCH"; then
38+ git checkout "$BRANCH"
39+ else
40+ git checkout -b "$BRANCH"
41+ fi
3842
3943 UNAME=$(uname -m)
4044 curl -O "https://download.swift.org/swiftly/linux/swiftly-$UNAME.tar.gz"
@@ -48,23 +52,21 @@ jobs:
4852
4953 latest=$(swiftly list-available main-snapshot | grep main-snapshot | head -n 1 | awk '{print $1}')
5054 echo -n "$latest" > .swift-version
55+ echo "version=$latest" >> "$GITHUB_OUTPUT"
5156 if [[ -z "$(git status --porcelain .swift-version)" ]]; then
5257 echo "No changes. Exiting."
53- exit 78 # neutral exit status
58+ exit 0 # neutral exit status
5459 fi
5560
5661 git add .swift-version
5762 git commit -m "Update Swift version to $latest"
5863 git push -u origin "$BRANCH"
5964
60- - name : Create or update PR
61- id : find-pr
62- run : |
6365 gh auth setup-git
6466 pr_number=$(gh pr list --head ci/update-swift-version --state open --json number --jq '.[0]')
6567
66- TITLE="ci: update Swift version to ${{ steps. latest.outputs.version }} "
67- BODY="This PR updates the \`.swift-version\` file to Swift ${{ steps. latest.outputs.version }} .
68+ TITLE="ci: update Swift version to $latest"
69+ BODY="This PR updates the \`.swift-version\` file to Swift $latest.
6870
6971 > This PR was automatically generated."
7072
0 commit comments