File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2525 fetch-depth : 0
2626
2727 - name : Check for dependency changes
28- if : ${{ !contains(github.event.pull_request.labels.*.name, inputs.label_name) }}
28+ if : ${{ github.event.pull_request && !contains(github.event.pull_request.labels.*.name, inputs.label_name) }}
2929 env :
3030 BASE_REF : ${{ github.event.pull_request.base.ref || github.event.repository.default_branch }}
3131 EXTRA_PATHS : ${{ inputs.extra_paths }}
4747 done
4848 fi
4949
50- CHANGED=$(git diff --name-only "origin/$BASE_REF"...HEAD -- "${PATHS[@]}")
50+ if git merge-base "origin/$BASE_REF" HEAD >/dev/null 2>&1; then
51+ CHANGED=$(git diff --name-only "origin/$BASE_REF"...HEAD -- "${PATHS[@]}")
52+ else
53+ echo "::warning title=Dependency Guard::No merge base found between HEAD and origin/$BASE_REF. Falling back to direct tree comparison (two-dot diff)."
54+ CHANGED=$(git diff --name-only "origin/$BASE_REF"..HEAD -- "${PATHS[@]}")
55+ fi
5156
5257 if [ -n "$CHANGED" ]; then
5358 echo "::error::Dependency files changed in this PR. A reviewer must verify the changes and add the '${{ inputs.label_name }}' label to unblock CI."
You can’t perform that action at this time.
0 commit comments