Skip to content

Commit e143dae

Browse files
authored
Merge pull request #4109 from Blargian/addendum_updates_3
Legal: trademark addendum - fix issue with step `check if docs changed`
2 parents 9d2f7ea + ae9b6f0 commit e143dae

File tree

1 file changed

+31
-10
lines changed

1 file changed

+31
-10
lines changed

.github/workflows/trademark-cla-notice.yml

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,41 @@ jobs:
3030
fetch-depth: 0
3131
# Use the GitHub App token if available, otherwise fallback to GITHUB_TOKEN
3232
token: ${{ steps.generate-token.outputs.token || secrets.GITHUB_TOKEN }}
33+
# For pull_request_target, we need to fetch the PR head
34+
ref: ${{ github.event.pull_request.head.sha }}
3335

3436
- name: Check if docs changed
3537
id: docs-changed
3638
if: github.event_name == 'pull_request_target'
37-
run: |
38-
changed_files=$(git diff --name-only ${{ github.event.pull_request.base.sha}} ${{ github.event.pull_request.head.sha}})
39-
40-
if echo "$changed_files" | grep -E '^docs/integrations/|^docs/static/' > /dev/null; then
41-
echo "docs_changed=true" >> $GITHUB_OUTPUT
42-
echo "requires_cla=true" >> $GITHUB_OUTPUT
43-
else
44-
echo "docs_changed=false" >> $GITHUB_OUTPUT
45-
echo "requires_cla=false" >> $GITHUB_OUTPUT
46-
fi
39+
uses: actions/github-script@v7
40+
with:
41+
github-token: ${{ steps.generate-token.outputs.token || secrets.GITHUB_TOKEN }}
42+
script: |
43+
// Get the list of changed files using GitHub API
44+
const { data: files } = await github.rest.pulls.listFiles({
45+
owner: context.repo.owner,
46+
repo: context.repo.repo,
47+
pull_number: context.payload.pull_request.number
48+
});
49+
50+
// Check if any files match our patterns
51+
const hasDocsChanges = files.some(file =>
52+
file.filename.startsWith('docs/integrations/') ||
53+
file.filename.startsWith('docs/static/')
54+
);
55+
56+
console.log('Changed files:');
57+
files.forEach(file => console.log(` ${file.filename}`));
58+
59+
if (hasDocsChanges) {
60+
console.log('Found changes in docs/integrations/ or docs/static/ - CLA required');
61+
core.setOutput('docs_changed', 'true');
62+
core.setOutput('requires_cla', 'true');
63+
} else {
64+
console.log('No changes found in docs/integrations/ or docs/static/ - CLA not required');
65+
core.setOutput('docs_changed', 'false');
66+
core.setOutput('requires_cla', 'false');
67+
}
4768
4869
- name: Get PR info for comment events
4970
id: pr-info

0 commit comments

Comments
 (0)