ci(contributor-check): add base-ref fallback for Gitea checkout robustness #34
Reference in New Issue
Block a user
Delete Branch "local/fix-contributor-check-robustness"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes contributor attribution check failures when Gitea checkout does not fetch the base ref (common on shallow clones).
Changes:
git fetch --depth=100 origin mainfallback whengithub.event.pull_request.base.shais not locally resolvable.git merge-base origin/main HEAD.Test plan:
Co-Authored-By: Claude Opus 4.7 noreply@anthropic.com
Gitea Actions + act_runner sometimes do not fetch the PR base ref (origin/main) even with fetch-depth: 0, causing `git merge-base` and `git diff --name-only` to fail with fatal errors. Add the same fallback pattern already used in tests.yml: 1. Try `git cat-file -e` to verify the base SHA exists. 2. If missing, `git fetch --depth=100 origin main`. 3. If still missing, fall back to `git merge-base origin/main HEAD`. 4. If merge-base also fails, exit with a clear error message. Also use `${{ github.event.pull_request.base.sha }}` consistently in both steps instead of mixing event vars with `origin/main`. Local-only change — defer PR open until CTO unblocks bundle. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>LGTM. Shallow-clone base-ref fallback is correct and defensive — three-tier approach handles Gitea Actions shallow checkout gracefully. Security and performance impact zero. Approving.
New commits pushed, approval review dismissed automatically according to repository settings
6e3451fa79to71f6acfe25LGTM — base-ref fallback is scoped to Gitea checkout robustness, preserves fail-closed attribution when no base can be resolved, and has no security or performance concerns.