Skip to content

Commit f23d480

Browse files
authored
ci: fix test-migrations target when main branch is not present locally (#13306)
1 parent f66d044 commit f23d480

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -797,8 +797,11 @@ test-postgres: test-postgres-docker
797797
test-migrations: test-postgres-docker
798798
echo "--- test migrations"
799799
set -euo pipefail
800-
COMMIT_FROM=$(shell git rev-parse --short HEAD)
801-
COMMIT_TO=$(shell git rev-parse --short main)
800+
COMMIT_FROM=$(shell git log -1 --format='%h' HEAD)
801+
echo "COMMIT_FROM=$${COMMIT_FROM}"
802+
COMMIT_TO=$(shell git log -1 --format='%h' origin/main)
803+
echo "COMMIT_TO=$${COMMIT_TO}"
804+
if [[ "$${COMMIT_FROM}" == "$${COMMIT_TO}" ]]; then echo "Nothing to do!"; exit 0; fi
802805
echo "DROP DATABASE IF EXISTS migrate_test_$${COMMIT_FROM}; CREATE DATABASE migrate_test_$${COMMIT_FROM};" | psql 'postgresql://postgres:postgres@localhost:5432/postgres?sslmode=disable'
803806
go run ./scripts/migrate-test/main.go --from="$$COMMIT_FROM" --to="$$COMMIT_TO" --postgres-url="postgresql://postgres:postgres@localhost:5432/migrate_test_$${COMMIT_FROM}?sslmode=disable"
804807

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy