diff --git a/bin/job b/bin/job index 7f3ad091..23db0ad7 100755 --- a/bin/job +++ b/bin/job @@ -24,8 +24,9 @@ job_pages() ( bail() ( set -euo pipefail + git show --shortstat echo - echo "Job failed" + echo "Failure caused by the above commit" exit 1 ) @@ -47,7 +48,20 @@ run() ( cd "$(git rev-parse --show-toplevel)" - job_"$job" || bail + if [[ -z "${CI_MERGE_REQUEST_DIFF_BASE_SHA+x}" ]]; then + echo "Running against latest commit only..." + + job_"$job" || bail + else + echo "Running against all commits since this branch's base..." + + readarray -t commits < \ + <(git rev-list --reverse "$CI_MERGE_REQUEST_DIFF_BASE_SHA..HEAD") + for commit in "${commits[@]}"; do + git checkout "$commit" + job_"$job" || bail + done + fi ) run "$@"