Skip to content

Commit 98834da

Browse files
committed
[Fix] workflow(owner-notification): fix workflow error
Signed-off-by: samzong <[email protected]>
1 parent 7384093 commit 98834da

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

.github/workflows/owner-notification.yml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,19 @@ jobs:
2323

2424
- name: Get changed files
2525
id: changed-files
26-
uses: tj-actions/changed-files@v46
26+
uses: actions/github-script@v7
2727
with:
28-
files: |
29-
**/*
30-
base_sha: ${{ github.event.pull_request.base.sha }}
31-
sha: ${{ github.event.pull_request.head.sha }}
28+
result-encoding: string
29+
script: |
30+
// Retrieve changed files via GitHub API to avoid relying on fork refs
31+
const files = await github.paginate(github.rest.pulls.listFiles, {
32+
owner: context.repo.owner,
33+
repo: context.repo.repo,
34+
pull_number: context.issue.number,
35+
per_page: 100,
36+
});
37+
const filenames = files.map(f => f.filename);
38+
core.setOutput('all_changed_files', filenames.join(' '));
3239
3340
- name: Find owners and notify
3441
uses: actions/github-script@v7
@@ -51,9 +58,9 @@ jobs:
5158
const ownerPath = path.join(firstLevelDir, 'OWNER');
5259
if (fs.existsSync(ownerPath)) {
5360
const content = fs.readFileSync(ownerPath, 'utf8');
54-
const owners = content.split('\n')
55-
.filter(line => line.trim().startsWith('@'))
56-
.map(line => line.trim());
61+
const owners = content.split('\n')
62+
.filter(line => line.trim().startsWith('@'))
63+
.map(line => line.trim());
5764
if (owners.length > 0) {
5865
return { path: firstLevelDir, owners };
5966
}

0 commit comments

Comments
 (0)