diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7e8fa0b..207131c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,6 +8,7 @@ on: - "scripts/diff_to_tbl.luau" - "scripts/test_runner.luau" - "scripts/depgraph.luau" + - "scripts/mock/**" - "testkit.luau" pull_request: branches: [ main ] @@ -16,13 +17,12 @@ on: - "scripts/test_runner.luau" - "scripts/depgraph.luau" - "testkit.luau" + - "scripts/mock/**" jobs: Main: runs-on: ${{ matrix.runner-os }} name: ${{ matrix.name }} - env: - GH_TOKEN: ${{ github.token }} strategy: fail-fast: false matrix: @@ -38,20 +38,26 @@ jobs: steps: - uses: CompeyDev/setup-rokit@v0.1.0 - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + with: + fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }} - name: Install Toolchain run: rokit install --no-trust-check - - name: Fetch diff - id: fetch_diff - shell: bash + - name: Fetch Diff run: | - if [ "${{ github.event_name }}" == "pull_request" ]; then - echo "diff=(gh pr diff ${{ github.event.pull_request.number }})" >> .diff - else - echo "diff=$(gh api repos/${{ github.repository }}/commits/${{ github.sha }} --header 'Accept: application/vnd.github.v3.diff')" >> .diff - fi + case '${{ github.event_name }}' in + push) + firstCommit='${{ github.event.commits[0].id }}' + lastCommit='${{ github.event.commits[-1].id }}' + ;; + pull_request) + firstCommit='${{ github.event.base_ref }}' + lastCommit='${{ github.event.head_ref }}' + ;; + esac + echo "diff=$(git diff --name-only --diff-filter=d "${firstCommit}~1" "${lastCommit}")" >> .diff - name: Run test runner run: lune run scripts/test_runner diff --git a/scripts/diff_reader.luau b/scripts/diff_reader.luau index 01bb37a..fe11bf9 100644 --- a/scripts/diff_reader.luau +++ b/scripts/diff_reader.luau @@ -15,6 +15,8 @@ local LIB_FILENAME_BLACKLIST = table.freeze({ local GMATCH = string.gmatch local diff_reader = {} +print(DEFAULT_DIFF) + function diff_reader.libs(diff: string?): ({ string }, { [string]: boolean }) local diff = diff or DEFAULT_DIFF local changed_array = {}