diff --git a/.github/workflows/extension_bump.yml b/.github/workflows/extension_bump.yml index afb5448691610f49f715956b99a4f80bc84c9327..4f9ee444aced59ea84f65a348546fdf4715a5190 100644 --- a/.github/workflows/extension_bump.yml +++ b/.github/workflows/extension_bump.yml @@ -38,10 +38,9 @@ jobs: name: extension_bump::compare_versions run: | 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)"; then git 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.yml index b843b6626e5e9969b0052f5de100143dd846b4a5..3bc3d43b0521b2ce946be386b318d9a3784c22d8 100644 --- a/.github/workflows/extension_tests.yml +++ b/.github/workflows/extension_tests.yml @@ -113,10 +113,9 @@ jobs: name: extension_bump::compare_versions run: | 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)"; then git 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_change run: | if [[ ${{ steps.compare-versions-check.outputs.version_changed }} == "true" && "${{ github.event_name }}" == "pull_request" && "${{ github.event.pull_request.user.login }}" != "zed-zippy[bot]" ]] ; then diff --git a/tooling/xtask/src/tasks/workflows/extension_bump.rs b/tooling/xtask/src/tasks/workflows/extension_bump.rs index eed7c79c8c2234309dfcde2c7e7b0d8d5cde9117..e06e50fa6ea8aefaf071a63010e54dd18ab9d70d 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, 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)"; then git checkout "$BRANCH_PARENT_SHA" else @@ -168,6 +167,7 @@ pub(crate) fn compare_versions() -> (Step, 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");