From 5caa0f9fdc5594d7e16423d083091a61df364b46 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Thu, 6 Mar 2025 19:34:40 +0800 Subject: [PATCH] Update ci.yml --- .github/workflows/ci.yml | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 38cf61d44..6ee78b129 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,13 +9,13 @@ on: - "domains/*" - "tests/*" - "util/*" - - ".github/workflows/validation.yml" + - ".github/workflows/ci.yml" - "dnsconfig.js" workflow_dispatch: concurrency: - group: ${{ github.ref }}-validation + group: ${{ github.ref }}-ci cancel-in-progress: true jobs: @@ -27,4 +27,17 @@ jobs: - run: npm install - - run: npx ava tests/*.test.js + - name: Get PR author + if: github.event_name == 'pull_request' + run: echo "PR_AUTHOR=${{ github.event.pull_request.user.login }}" >> $GITHUB_ENV + + - name: Get changed files + if: github.event_name == 'pull_request' + run: | + CHANGED_FILES=$(gh pr view ${{ github.event.pull_request.number }} --json files -q '.files[].path' | jq -c .) + echo "CHANGED_FILES=$CHANGED_FILES" >> $GITHUB_ENV + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Run tests + run: npx ava tests/*.test.js