extension_ci: Use fork point for version comparison (#49972)
Lost another battle to the GitHub docs. Instead, now let's just do it ourselves here in bash and not guess whatever GitHub is referring to in their documentation.. Release Notes: - N/A
This commit is contained in:
1 parent
27169efb96
commit
7e29079083
3 files changed
+9
-11
No files matched your search
@@ -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 }}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in new issue
Block a user