mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-08-04 08:28:36 +00:00
fix(ci): scope PR path detection to head changes
This commit is contained in:
parent
019d7816a7
commit
9070d7489a
11
.github/workflows/ci.yml
vendored
11
.github/workflows/ci.yml
vendored
@ -33,13 +33,20 @@ jobs:
|
|||||||
id: paths
|
id: paths
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
|
EVENT_NAME: ${{ github.event_name }}
|
||||||
BASE_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }}
|
BASE_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }}
|
||||||
HEAD_SHA: ${{ github.sha }}
|
HEAD_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
|
||||||
run: |
|
run: |
|
||||||
python_required=true
|
python_required=true
|
||||||
|
|
||||||
|
if [[ "$EVENT_NAME" == "pull_request" ]]; then
|
||||||
|
diff_range="${BASE_SHA}...${HEAD_SHA}"
|
||||||
|
else
|
||||||
|
diff_range="${BASE_SHA}..${HEAD_SHA}"
|
||||||
|
fi
|
||||||
|
|
||||||
if git cat-file -e "${BASE_SHA}^{commit}" 2>/dev/null &&
|
if git cat-file -e "${BASE_SHA}^{commit}" 2>/dev/null &&
|
||||||
changed_files="$(git diff --name-only --no-renames "$BASE_SHA" "$HEAD_SHA")" &&
|
changed_files="$(git diff --name-only --no-renames "$diff_range")" &&
|
||||||
[[ -n "$changed_files" ]] &&
|
[[ -n "$changed_files" ]] &&
|
||||||
! grep -qvE '^(webui/|nanobot/channels/[^/]+/webui/|docs/)' <<< "$changed_files"; then
|
! grep -qvE '^(webui/|nanobot/channels/[^/]+/webui/|docs/)' <<< "$changed_files"; then
|
||||||
python_required=false
|
python_required=false
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user