fix(workflows): resolve git revision error in KB lint workflow

- Fix HEAD~1...HEAD error for shallow clones by using github.event.before/after
- Add proper error suppression with 2>/dev/null
- Add fallback logic for edge cases (initial commits, force pushes)
- Archive resolved runner setup issue to docs/issues/archive/resolved/
- Add archive documentation and next steps guide

Fixes workflow execution on test/runner-validation branch.
Resolves issue with 'fatal: bad revision' error in logs.
This commit is contained in:
Gitea Actions
2025-11-11 14:46:26 -07:00
parent 72d74f86ad
commit 1423ee1f04
4 changed files with 209 additions and 4 deletions

View File

@@ -32,10 +32,21 @@ jobs:
# Find all KB files that changed
if [ "${{ github.event_name }}" = "pull_request" ]; then
# For pull requests, check changed files
changed_files=$(git diff --name-only --diff-filter=ACMR origin/${{ github.base_ref }}...HEAD -- 'kb/**/*.md' || true)
changed_files=$(git diff --name-only --diff-filter=ACMR origin/${{ github.base_ref }}...HEAD -- 'kb/**/*.md' 2>/dev/null || true)
else
# For push, check all KB files
changed_files=$(git diff --name-only --diff-filter=ACMR HEAD~1...HEAD -- 'kb/**/*.md' || find kb -type f -name "*.md" 2>/dev/null || true)
# For push events, use commit SHAs from event (works with shallow clones)
# Fallback to finding all KB files if commit comparison fails
if [ -n "${{ github.event.before }}" ] && [ "${{ github.event.before }}" != "0000000000000000000000000000000000000000" ]; then
changed_files=$(git diff --name-only --diff-filter=ACMR ${{ github.event.before }}...${{ github.event.after }} -- 'kb/**/*.md' 2>/dev/null || true)
else
# If no before commit (e.g., initial commit or force push), check all KB files
changed_files=$(find kb -type f -name "*.md" 2>/dev/null || true)
fi
# If git diff failed or returned empty, fallback to finding all KB files
if [ -z "$changed_files" ]; then
changed_files=$(find kb -type f -name "*.md" 2>/dev/null || true)
fi
fi
if [ -z "$changed_files" ]; then