-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[ci](fix) license check #62495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ci](fix) license check #62495
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,17 +48,40 @@ 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 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This still fails in the runner's shallow-checkout layout. With the exact sequence used here:\n\n\n\n\n\nthere is often no merge base, and I reproduced that on this PR head locally in the Actions workspace (). So the PR path still cannot reliably compute changed files. This needs either enough history to guarantee a merge base, or a changed-files mechanism that does not depend on a shallow three-dot diff.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This still fails in the runner's shallow-checkout layout. With the exact sequence used here:
there is often no merge base, and I reproduced that on this PR head in the Actions workspace ( |
||
| 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 | ||
| acmr=$(git diff --name-only --diff-filter=ACMR "${base_sha}...HEAD") | ||
| if [ -z "$acmr" ]; then | ||
| exit 0 | ||
| fi | ||
| { | ||
| echo "added_modified<<EOF" | ||
| echo "$acmr" | ||
| echo "EOF" | ||
| } >> "$GITHUB_OUTPUT" | ||
| echo "config_file=.licenserc-incremental.yaml" >> "$GITHUB_OUTPUT" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| - name: Generate incremental licenserc | ||
| if: github.event_name == 'pull_request_target' && steps.changed-files.outputs.all_changed_files != '' | ||
| if: >- | ||
| github.event_name == 'pull_request_target' && | ||
| steps.changed-files.outputs.added_modified != '' | ||
| env: | ||
| CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} | ||
| CHANGED_FILES: ${{ steps.changed-files.outputs.added_modified }} | ||
| run: | | ||
| python3 - <<'EOF' | ||
| import yaml, os | ||
|
|
@@ -76,9 +99,11 @@ jobs: | |
| EOF | ||
|
|
||
| - name: Check License | ||
| if: github.event_name != 'pull_request_target' || steps.changed-files.outputs.all_changed_files != '' | ||
| if: >- | ||
| github.event_name != 'pull_request_target' || | ||
| steps.changed-files.outputs.config_file != '' | ||
| uses: apache/skywalking-eyes@v0.8.0 | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| with: | ||
| config: ${{ github.event_name == 'pull_request_target' && '.licenserc-incremental.yaml' || '.licenserc.yaml' }} | ||
| config: ${{ steps.changed-files.outputs.config_file || '.licenserc.yaml' }} | ||
Uh oh!
There was an error while loading. Please reload this page.