Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 35 additions & 20 deletions .github/workflows/release-branch-validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout with history
- name: Checkout with parent
uses: actions/checkout@v7
with:
fetch-depth: 0
# Shallow: just HEAD and HEAD~1. Multi-commit pushes fetch the
# older base on demand in the "Determine changed X files" step.
fetch-depth: 2
persist-credentials: false

- name: Determine changed Java files
Expand All @@ -61,6 +63,9 @@ jobs:
if [ -z "${BEFORE}" ] || [ "${BEFORE}" = "0000000000000000000000000000000000000000" ]; then
BASE=$(git rev-parse HEAD~1)
else
# Multi-commit push: BEFORE may be older than the shallow depth 2
# checkout carries, so pull just that one object on demand.
git cat-file -e "${BEFORE}" 2>/dev/null || git fetch --depth=1 origin "${BEFORE}"
BASE="${BEFORE}"
fi
CHANGED=$(git diff --name-only --diff-filter=ACMR "${BASE}" HEAD -- '*.java' | tr '\n' ' ')
Expand Down Expand Up @@ -90,35 +95,37 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-

- name: Run spotless (full tree apply)
if: steps.files.outputs.any == 'true'
run: mvn -B spotless:apply

- name: Fail only if changed Java files diverged
- name: Run spotless:check on changed Java files only
if: steps.files.outputs.any == 'true'
env:
CHANGED: ${{ steps.files.outputs.changed }}
run: |
set -euo pipefail
# Guard against baseline drift: only assert on files the push touched.
# xargs is used so an empty CHANGED simply exits 0 rather than diffing all.
if [ -z "${CHANGED}" ]; then exit 0; fi
if [ -n "$(echo ${CHANGED} | xargs git status --porcelain --)" ]; then
echo "spotless:apply rewrote files pushed by this commit:"
echo ${CHANGED} | xargs git status --porcelain --
echo ${CHANGED} | xargs git --no-pager diff --
exit 1
fi
# spotless-maven-plugin accepts a comma-separated list of regexes
# matched against absolute file paths. Build one regex per file with
# `.` escaped and a `.*` prefix so it survives Maven's absolutization.
PATTERNS=""
for f in ${CHANGED}; do
# Escape regex metacharacters we might see in filenames.
ESCAPED=$(printf '%s' "$f" | sed 's/[][().^$+*?|\\]/\\&/g')
PATTERNS="${PATTERNS}${PATTERNS:+,}.*${ESCAPED}"
done
echo "spotless:check regex: ${PATTERNS}"
# Baseline drift on other files is intentionally ignored; scope
# matches the "Determine changed X files" step above.
mvn -B spotless:check "-DspotlessFiles=${PATTERNS}"

python-checkstyle:
name: Python Checkstyle
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout with history
- name: Checkout with parent
uses: actions/checkout@v7
with:
fetch-depth: 0
# Shallow: just HEAD and HEAD~1. Multi-commit pushes fetch the
# older base on demand in the "Determine changed X files" step.
fetch-depth: 2
persist-credentials: false

- name: Determine changed Python files
Expand All @@ -130,6 +137,9 @@ jobs:
if [ -z "${BEFORE}" ] || [ "${BEFORE}" = "0000000000000000000000000000000000000000" ]; then
BASE=$(git rev-parse HEAD~1)
else
# Multi-commit push: BEFORE may be older than the shallow depth 2
# checkout carries, so pull just that one object on demand.
git cat-file -e "${BEFORE}" 2>/dev/null || git fetch --depth=1 origin "${BEFORE}"
BASE="${BEFORE}"
fi
# Scope to the two dirs ingestion/Makefile:py_format_check targets.
Expand Down Expand Up @@ -176,10 +186,12 @@ jobs:
env:
UI_WORKING_DIRECTORY: openmetadata-ui/src/main/resources/ui
steps:
- name: Checkout with history
- name: Checkout with parent
uses: actions/checkout@v7
with:
fetch-depth: 0
# Shallow: just HEAD and HEAD~1. Multi-commit pushes fetch the
# older base on demand in the "Determine changed X files" step.
fetch-depth: 2
persist-credentials: false

- name: Determine changed UI files
Expand All @@ -191,6 +203,9 @@ jobs:
if [ -z "${BEFORE}" ] || [ "${BEFORE}" = "0000000000000000000000000000000000000000" ]; then
BASE=$(git rev-parse HEAD~1)
else
# Multi-commit push: BEFORE may be older than the shallow depth 2
# checkout carries, so pull just that one object on demand.
git cat-file -e "${BEFORE}" 2>/dev/null || git fetch --depth=1 origin "${BEFORE}"
BASE="${BEFORE}"
fi
# Match existing ui-checkstyle: src globs only, exclude generated/**.
Expand Down
Loading