diff --git a/.github/workflows/pricing-mutate.yml b/.github/workflows/pricing-mutate.yml index 953a70c2..4b1afae1 100644 --- a/.github/workflows/pricing-mutate.yml +++ b/.github/workflows/pricing-mutate.yml @@ -32,4 +32,4 @@ jobs: - name: Run incremental mutation testing run: make -C domains/pricing mutate-changes env: - GIT_BASE_SHA: ${{ github.event_name == 'push' && github.event.before || '' }} + GIT_BASE_SHA: ${{ github.event_name == 'push' && github.event.before || github.event.pull_request.base.sha }} diff --git a/.github/workflows/rails_application-mutate.yml b/.github/workflows/rails_application-mutate.yml index aef0679f..6f91679b 100644 --- a/.github/workflows/rails_application-mutate.yml +++ b/.github/workflows/rails_application-mutate.yml @@ -56,4 +56,4 @@ jobs: DATABASE_URL: "postgres://postgres:secret@localhost:5432/cqrs-es-sample-with-res_test" RAILS_ENV: test MUTANT_OPTS: --jobs 4 - GIT_BASE_SHA: ${{ github.event_name == 'push' && github.event.before || '' }} + GIT_BASE_SHA: ${{ github.event_name == 'push' && github.event.before || github.event.pull_request.base.sha }} diff --git a/apps/rails_application/Makefile b/apps/rails_application/Makefile index 20685538..61591a74 100644 --- a/apps/rails_application/Makefile +++ b/apps/rails_application/Makefile @@ -26,7 +26,9 @@ else @bundle exec mutant run $(MUTANT_OPTS) endif -GIT_BASE_SHA ?= $(shell git merge-base HEAD origin/master) +# Fall back to merge-base when GIT_BASE_SHA is empty or the git null SHA +# (push of a new branch sets github.event.before to 0000…0). +GIT_BASE_SHA := $(or $(filter-out 0000000000000000000000000000000000000000,$(GIT_BASE_SHA)),$(shell git merge-base HEAD origin/master)) mutate-changes: ## Run incremental mutation tests on changes @echo "Running incremental mutation tests against $(GIT_BASE_SHA)..." diff --git a/domains/pricing/Makefile b/domains/pricing/Makefile index 7382e574..91de9de2 100644 --- a/domains/pricing/Makefile +++ b/domains/pricing/Makefile @@ -1,4 +1,6 @@ -GIT_BASE_SHA ?= $(shell git merge-base HEAD origin/master) +# Fall back to merge-base when GIT_BASE_SHA is empty or the git null SHA +# (push of a new branch sets github.event.before to 0000…0). +GIT_BASE_SHA := $(or $(filter-out 0000000000000000000000000000000000000000,$(GIT_BASE_SHA)),$(shell git merge-base HEAD origin/master)) install: @bundle install