From 8858d34aa04cf9243bd8a61fc99fdef3f012677f Mon Sep 17 00:00:00 2001 From: John Luo Date: Sun, 3 Dec 2023 19:44:30 -0500 Subject: [PATCH] Try github script --- .github/actions/post-checkout/action.yml | 33 ++++++++++++------------ 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/.github/actions/post-checkout/action.yml b/.github/actions/post-checkout/action.yml index 5c06b61e0..1936fb88c 100644 --- a/.github/actions/post-checkout/action.yml +++ b/.github/actions/post-checkout/action.yml @@ -7,22 +7,23 @@ runs: - name: Check for documentation only changes id: docs-only - run: | - git log --max-count=10; - docs_only="true"; - while read filepath; do - if [ $filepath == *.md ]; then - echo "${filepath} is a documentation file"; - else - echo "${filepath} is a non documentation file"; - docs_only="false"; - fi; - done < <(git diff --name-only "${GITHUB_BASE_BRANCH}" "${GITHUB_PR_BRANCH}"); - echo "docs_only=${docs_only}" >> $GITHUB_OUTPUT; - shell: bash - env: - GITHUB_BASE_BRANCH: ${{ github.event.pull_request.base.ref }} - GITHUB_PR_BRANCH: ${{ github.event.pull_request.head.ref }} + uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 + with: + script: | + const opts = github.rest.pulls.listFiles.endpoint.merge({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.payload.pull_request.number, + }) + const files = await github.paginate(opts) + for (const file of files) { + console.log(file) + if (!file.endsWith('.md')) { + return "false" + } + } + return "true" + result-encoding: string - name: Get Composer cache directory id: composer-cache