File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,19 +25,21 @@ jobs:
2525 steps :
2626 - name : Checkout
2727 uses : actions/checkout@v5
28- with :
29- fetch-depth : 2 # need to fetch 2 to get list of changed files
3028
3129 - name : Get changed files
3230 id : changed_files
33- shell : bash
34- run : |
35- firstCommit='${{ github.event.pull_request.base.sha }}'
36- lastCommit='${{ github.event.pull_request.head.sha }}'
37- changedFiles=$(git diff --name-only --diff-filter=d "${firstCommit}" "${lastCommit}" | tr '\n' ' ')
38-
39- echo "Changed files: ${changedFiles}"
40- echo "CHANGED_FILES=${changedFiles}" >> "${GITHUB_OUTPUT}"
31+ uses : actions/github-script@v7
32+ with :
33+ script : |
34+ const opts = github.rest.pulls.listFiles.endpoint.merge({
35+ owner: context.repo.owner,
36+ repo: context.repo.repo,
37+ pull_number: context.issue.number,
38+ });
39+ const changedFiles = await github.paginate(opts);
40+ const changedFilesString = changedFiles.map(file => file.filename).join(' ');
41+ console.log(`Changed files: ${changedFilesString}`);
42+ core.setOutput('CHANGED_FILES', changedFilesString);
4143
4244 - name : Download problem matchers
4345 shell : bash
You can’t perform that action at this time.
0 commit comments