From 8803196837714b849374c512790389e12ec5d3a5 Mon Sep 17 00:00:00 2001 From: Aleksey Khoroshilov Date: Wed, 24 Jul 2024 20:09:24 +0700 Subject: [PATCH] Fetch base commit instead of all history for lint purposes. --- .github/workflows/generate-test-seed.yml | 8 +++++--- .github/workflows/test-src.yml | 10 +++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/generate-test-seed.yml b/.github/workflows/generate-test-seed.yml index ddbae174..6e88b64e 100644 --- a/.github/workflows/generate-test-seed.yml +++ b/.github/workflows/generate-test-seed.yml @@ -11,13 +11,15 @@ jobs: runs-on: ubuntu-latest env: ACTION_RUN_URL: '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}' + BASE_SHA: '${{ github.event.pull_request.base.sha }}' REMOTE_SEED_PATH: 'pull/${{ github.event.pull_request.number }}/seed' SEED_VERSION: 'pull/${{ github.event.pull_request.number }}@${{ github.event.pull_request.head.sha }}' steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - with: - fetch-depth: 0 + + - name: Fetch base commit + run: git fetch --depth=1 origin "$BASE_SHA" - name: Setup Python uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5 @@ -59,7 +61,7 @@ jobs: - name: Lint run: | - npm run lint -- --base ${{ github.event.pull_request.base.sha }} + npm run lint -- --base "$BASE_SHA" - name: Generate seed run: | diff --git a/.github/workflows/test-src.yml b/.github/workflows/test-src.yml index 0d296512..83681777 100644 --- a/.github/workflows/test-src.yml +++ b/.github/workflows/test-src.yml @@ -7,10 +7,14 @@ on: jobs: build: runs-on: ubuntu-latest + env: + BASE_SHA: '${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha }}' + steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - with: - fetch-depth: 0 + + - name: fetch base commit + run: git fetch --depth=1 origin "$BASE_SHA" - name: npm install run: npm install @@ -25,4 +29,4 @@ jobs: run: npm run test - name: lint - run: npm run lint -- --base ${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha }} + run: npm run lint -- --base "$BASE_SHA"