github-actions[bot] commented on code in PR #62495:
URL: https://github.com/apache/doris/pull/62495#discussion_r3086291951
##########
.github/workflows/license-eyes.yml:
##########
@@ -48,17 +48,36 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}
+ - name: Fetch base branch for diff
+ if: github.event_name == 'pull_request_target'
+ run: git fetch --no-tags --depth=1 origin ${{ github.base_ref }}
+
- name: Get changed files
if: github.event_name == 'pull_request_target'
id: changed-files
- uses: tj-actions/changed-files@v45
- with:
- separator: "\n"
+ run: |
+ base_sha=$(git rev-parse FETCH_HEAD)
+ if ! all=$(git diff --name-only "${base_sha}..HEAD" 2>/dev/null);
then
+ echo "config_file=.licenserc.yaml" >> "$GITHUB_OUTPUT"
+ exit 0
+ fi
+ if echo "$all" | grep -qxF '.licenserc.yaml'; then
+ echo "config_file=.licenserc.yaml" >> "$GITHUB_OUTPUT"
+ exit 0
+ fi
+ {
+ echo "added_modified<<EOF"
+ git diff --name-only --diff-filter=ACMR "${base_sha}..HEAD"
+ echo "EOF"
+ } >> "$GITHUB_OUTPUT"
+ echo "config_file=.licenserc-incremental.yaml" >> "$GITHUB_OUTPUT"
Review Comment:
`config_file` is set to `.licenserc-incremental.yaml` unconditionally here,
even when `git diff --diff-filter=ACMR` returned no files. In a delete-only PR,
`Generate incremental licenserc` is skipped, the incremental file is never
created, and `Check License` still tries to read it. Please only set the
incremental config when `added_modified` is non-empty, or skip the license step
entirely for delete-only PRs.
##########
.github/workflows/license-eyes.yml:
##########
@@ -48,17 +48,36 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}
+ - name: Fetch base branch for diff
+ if: github.event_name == 'pull_request_target'
+ run: git fetch --no-tags --depth=1 origin ${{ github.base_ref }}
+
- name: Get changed files
if: github.event_name == 'pull_request_target'
id: changed-files
- uses: tj-actions/changed-files@v45
- with:
- separator: "\n"
+ run: |
+ base_sha=$(git rev-parse FETCH_HEAD)
+ if ! all=$(git diff --name-only "${base_sha}..HEAD" 2>/dev/null);
then
Review Comment:
Using `${base_sha}..HEAD` here compares the PR head against the current tip
of the base branch, not against the PR merge base. If `master` advances after
the branch is cut, files changed only on the base branch show up as `M` here
and get copied into `added_modified`, so the incremental license check can fail
on unrelated files. This needs merge-base semantics (`...` or equivalent), with
the existing fallback to `.licenserc.yaml` when shallow history cannot resolve
the merge base.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]