From 3ad22cf17efb311919cda888fd27947b6ed8aec9 Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Sun, 31 Aug 2025 16:56:13 -0400 Subject: [PATCH] fix(lint): get changed files via rest API --- .github/workflows/__call-common-lint.yml | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/workflows/__call-common-lint.yml b/.github/workflows/__call-common-lint.yml index a75ec8b8..f614f90f 100644 --- a/.github/workflows/__call-common-lint.yml +++ b/.github/workflows/__call-common-lint.yml @@ -25,19 +25,21 @@ jobs: steps: - name: Checkout uses: actions/checkout@v5 - with: - fetch-depth: 2 # need to fetch 2 to get list of changed files - name: Get changed files id: changed_files - shell: bash - run: | - firstCommit='${{ github.event.pull_request.base.sha }}' - lastCommit='${{ github.event.pull_request.head.sha }}' - changedFiles=$(git diff --name-only --diff-filter=d "${firstCommit}" "${lastCommit}" | tr '\n' ' ') - - echo "Changed files: ${changedFiles}" - echo "CHANGED_FILES=${changedFiles}" >> "${GITHUB_OUTPUT}" + uses: actions/github-script@v7 + with: + script: | + const opts = github.rest.pulls.listFiles.endpoint.merge({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.issue.number, + }); + const changedFiles = await github.paginate(opts); + const changedFilesString = changedFiles.map(file => file.filename).join(' '); + console.log(`Changed files: ${changedFilesString}`); + core.setOutput('CHANGED_FILES', changedFilesString); - name: Download problem matchers shell: bash