Skip to content

armgit / zed

Public Imported from GitHub
0

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 fork point for version comparison (#49972)

Finn Evers0f21e2a5c608
diff --git a/.github/workflows/extension_bump.yml b/.github/workflows/extension_bump.yml
index 4f9ee444ace..ff903eb63d3 100644
--- a/.github/workflows/extension_bump.yml
+++ b/.github/workflows/extension_bump.yml
@@ -39,8 +39,9 @@ jobs:
run: |
CURRENT_VERSION="$(sed -n 's/^version = \"\(.*\)\"/\1/p' < extension.toml | tr -d '[:space:]')"
- if [[ -n "$PR_PARENT_REF" ]]; then
- git checkout "$PR_PARENT_REF"
+ if [[ "${{ github.event_name }}" == "pull_request" ]]; then
+ PR_FORK_POINT="$(git merge-base --fork-point main)"
+ git checkout "$PR_FORK_POINT"
elif BRANCH_PARENT_SHA="$(git merge-base origin/main origin/zed-zippy-autobump)"; then
git checkout "$BRANCH_PARENT_SHA"
else
@@ -54,8 +55,6 @@ 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 3bc3d43b052..ed35a054241 100644
--- a/.github/workflows/extension_tests.yml
+++ b/.github/workflows/extension_tests.yml
@@ -114,8 +114,9 @@ jobs:
run: |
CURRENT_VERSION="$(sed -n 's/^version = \"\(.*\)\"/\1/p' < extension.toml | tr -d '[:space:]')"
- if [[ -n "$PR_PARENT_REF" ]]; then
- git checkout "$PR_PARENT_REF"
+ if [[ "${{ github.event_name }}" == "pull_request" ]]; then
+ PR_FORK_POINT="$(git merge-base --fork-point main)"
+ git checkout "$PR_FORK_POINT"
elif BRANCH_PARENT_SHA="$(git merge-base origin/main origin/zed-zippy-autobump)"; then
git checkout "$BRANCH_PARENT_SHA"
else
@@ -129,8 +130,6 @@ 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 e06e50fa6ea..bdc25f766e3 100644
--- a/tooling/xtask/src/tasks/workflows/extension_bump.rs
+++ b/tooling/xtask/src/tasks/workflows/extension_bump.rs
@@ -150,8 +150,9 @@ pub(crate) fn compare_versions() -> (Step<Run>, StepOutput, StepOutput) {
r#"
CURRENT_VERSION="$({VERSION_CHECK})"
- if [[ -n "$PR_PARENT_REF" ]]; then
- git checkout "$PR_PARENT_REF"
+ if [[ "${{{{ github.event_name }}}}" == "pull_request" ]]; then
+ PR_FORK_POINT="$(git merge-base --fork-point main)"
+ git checkout "$PR_FORK_POINT"
elif BRANCH_PARENT_SHA="$(git merge-base origin/main origin/zed-zippy-autobump)"; then
git checkout "$BRANCH_PARENT_SHA"
else
@@ -167,7 +168,6 @@ 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");