ci: fix dubious ownership error on self-hosted runners (#106)

Add safe.directory '*' to git config before running git operations.
Self-hosted runners may run jobs under a different OS user than the
one that owns the workspace, causing git to refuse operations with a
'dubious ownership' error.
This commit is contained in:
Lei Zhang 2026-06-12 11:41:08 +08:00 committed by GitHub
parent 022800c876
commit 3239640df4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -45,6 +45,9 @@ jobs:
fetch-depth: 0 # Full history needed for merge-base diff
ref: ${{ github.event.pull_request.head.sha }}
- name: Mark repository as safe directory
run: git config --global --add safe.directory '*'
- name: Fetch PR head ref (ensures fork commits are available)
run: git fetch origin pull/${{ github.event.pull_request.number }}/head