Skip the test gate on docs-only branches
CI / full-gate (push) Successful in 2m41s

This commit is contained in:
2026-08-02 13:31:07 +02:00
parent af4a70d904
commit 6c850b8923
3 changed files with 62 additions and 3 deletions
+22 -1
View File
@@ -8,7 +8,28 @@ jobs:
runs-on: docker-host
steps:
- uses: actions/checkout@v4.2.2
- run: bash ci.sh
with:
fetch-depth: 0 # the merge-base below needs history; checkout defaults to depth 1
- name: Detect a docs-only branch
id: scope
run: |
git fetch --no-tags --quiet origin +refs/heads/main:refs/remotes/origin/main
base=$(git merge-base refs/remotes/origin/main HEAD) \
|| { echo 'No merge-base with main - running the gate'; echo 'docs_only=false' >> "$GITHUB_OUTPUT"; exit 0; }
changed=$(git diff --name-only "$base" HEAD)
printf '%s\n' "$changed"
# Skip only when there IS a diff and every path is *.md. An empty diff, an unreadable
# range, anything else - fall through to the gate.
if [ -n "$changed" ] && ! printf '%s\n' "$changed" | grep -qvE '\.md$'; then
echo 'docs_only=true' >> "$GITHUB_OUTPUT"
else
echo 'docs_only=false' >> "$GITHUB_OUTPUT"
fi
- name: Full gate
if: steps.scope.outputs.docs_only != 'true'
run: bash ci.sh
# Never gated on docs_only: release.yml re-tags this exact image, and ff-only merges make
# every branch head a main commit - a main commit without an image is an unreleasable one.
- name: Push app image tagged with the commit hash
env:
IMAGE: gitea.larvit.se/${{ github.repository }}:${{ github.sha }}