File tree Expand file tree Collapse file tree 1 file changed +0
-4
lines changed
Expand file tree Collapse file tree 1 file changed +0
-4
lines changed Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22set -euo pipefail
33
4- # Run Prettier only on files changed against a base ref/commit
54ROOT_DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) /.." && pwd) "
65cd " $ROOT_DIR "
76
8- # Inputs that can be provided by CI
97BASE_SHA=" ${BASE_SHA:- } "
108BASE_REF=" ${BASE_REF:- ${GITHUB_BASE_REF:- } } "
119DEFAULT_BASE=" ${DEFAULT_BASE:- origin/ main} "
1816 DIFF_BASE=" $DEFAULT_BASE "
1917fi
2018
21- # Ensure the base ref exists locally
2219if ! git rev-parse --verify " ${DIFF_BASE} ^{commit}" > /dev/null 2>&1 ; then
2320 git fetch --no-tags --prune --depth=1 origin " ${DIFF_BASE# origin/ } " > /dev/null 2>&1 || true
2421fi
2522
26- # If still missing, bail out gracefully to avoid blocking CI
2723if ! git rev-parse --verify " ${DIFF_BASE} ^{commit}" > /dev/null 2>&1 ; then
2824 echo " Base ref ${DIFF_BASE} not found; skipping Prettier check." >&2
2925 exit 0
You can’t perform that action at this time.
0 commit comments