@@ -30,20 +30,41 @@ jobs:
30
30
fetch-depth : 0
31
31
# Use the GitHub App token if available, otherwise fallback to GITHUB_TOKEN
32
32
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 }}
33
35
34
36
- name : Check if docs changed
35
37
id : docs-changed
36
38
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
+ }
47
68
48
69
- name : Get PR info for comment events
49
70
id : pr-info
0 commit comments