Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
extension_ci: Use `head_ref` for version comparison (#49970)
Finn Eversf96ac58a3099
diff --git a/.github/workflows/extension_bump.yml b/.github/workflows/extension_bump.ymlindex afb54486916..4f9ee444ace 100644--- a/.github/workflows/extension_bump.yml+++ b/.github/workflows/extension_bump.yml@@ -38,10 +38,9 @@ jobs:name: extension_bump::compare_versionsrun: |CURRENT_VERSION="$(sed -n 's/^version = \"\(.*\)\"/\1/p' < extension.toml | tr -d '[:space:]')"- PR_PARENT_SHA="${{ github.event.pull_request.head.sha }}"- if [[ -n "$PR_PARENT_SHA" ]]; then- git checkout "$PR_PARENT_SHA"+ if [[ -n "$PR_PARENT_REF" ]]; then+ git checkout "$PR_PARENT_REF"elif BRANCH_PARENT_SHA="$(git merge-base origin/main origin/zed-zippy-autobump)"; thengit checkout "$BRANCH_PARENT_SHA"else@@ -55,6 +54,8 @@ jobs:echo "version_changed=true" >> "$GITHUB_OUTPUT"echo "current_version=${CURRENT_VERSION}" >> "$GITHUB_OUTPUT"+ env:+ PR_PARENT_REF: ${{ github.head_ref }}outputs:version_changed: ${{ steps.compare-versions-check.outputs.version_changed }}current_version: ${{ steps.compare-versions-check.outputs.current_version }}diff --git a/.github/workflows/extension_tests.yml b/.github/workflows/extension_tests.ymlindex b843b6626e5..3bc3d43b052 100644--- a/.github/workflows/extension_tests.yml+++ b/.github/workflows/extension_tests.yml@@ -113,10 +113,9 @@ jobs:name: extension_bump::compare_versionsrun: |CURRENT_VERSION="$(sed -n 's/^version = \"\(.*\)\"/\1/p' < extension.toml | tr -d '[:space:]')"- PR_PARENT_SHA="${{ github.event.pull_request.head.sha }}"- if [[ -n "$PR_PARENT_SHA" ]]; then- git checkout "$PR_PARENT_SHA"+ if [[ -n "$PR_PARENT_REF" ]]; then+ git checkout "$PR_PARENT_REF"elif BRANCH_PARENT_SHA="$(git merge-base origin/main origin/zed-zippy-autobump)"; thengit checkout "$BRANCH_PARENT_SHA"else@@ -130,6 +129,8 @@ jobs:echo "version_changed=true" >> "$GITHUB_OUTPUT"echo "current_version=${CURRENT_VERSION}" >> "$GITHUB_OUTPUT"+ env:+ PR_PARENT_REF: ${{ github.head_ref }}- name: extension_tests::verify_version_did_not_changerun: |if [[ ${{ steps.compare-versions-check.outputs.version_changed }} == "true" && "${{ github.event_name }}" == "pull_request" && "${{ github.event.pull_request.user.login }}" != "zed-zippy[bot]" ]] ; thendiff --git a/tooling/xtask/src/tasks/workflows/extension_bump.rs b/tooling/xtask/src/tasks/workflows/extension_bump.rsindex eed7c79c8c2..e06e50fa6ea 100644--- a/tooling/xtask/src/tasks/workflows/extension_bump.rs+++ b/tooling/xtask/src/tasks/workflows/extension_bump.rs@@ -149,10 +149,9 @@ pub(crate) fn compare_versions() -> (Step<Run>, StepOutput, StepOutput) {let check_needs_bump = named::bash(formatdoc! {r#"CURRENT_VERSION="$({VERSION_CHECK})"- PR_PARENT_SHA="${{{{ github.event.pull_request.head.sha }}}}"- if [[ -n "$PR_PARENT_SHA" ]]; then- git checkout "$PR_PARENT_SHA"+ if [[ -n "$PR_PARENT_REF" ]]; then+ git checkout "$PR_PARENT_REF"elif BRANCH_PARENT_SHA="$(git merge-base origin/main origin/zed-zippy-autobump)"; thengit checkout "$BRANCH_PARENT_SHA"else@@ -168,6 +167,7 @@ pub(crate) fn compare_versions() -> (Step<Run>, StepOutput, StepOutput) {echo "current_version=${{CURRENT_VERSION}}" >> "$GITHUB_OUTPUT""#})+ .add_env(("PR_PARENT_REF", Context::github().head_ref())).id("compare-versions-check");let version_changed = StepOutput::new(&check_needs_bump, "version_changed");