diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b18da4f6c43f..d78ac48a795f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -96,6 +96,8 @@ jobs: profiling_node: - 'packages/profiling-node/**' - 'dev-packages/e2e-tests/test-applications/node-profiling/**' + any_code: + - '!**/*.md' - name: Get PR labels @@ -109,6 +111,8 @@ jobs: is_release: ${{ startsWith(github.ref, 'refs/heads/release/') }} changed_profiling_node: ${{ steps.changed.outputs.profiling_node == 'true' }} changed_ci: ${{ steps.changed.outputs.workflow == 'true' }} + changed_any_code: ${{ steps.changed.outputs.any_code == 'true' }} + # When merging into master, or from master is_gitflow_sync: ${{ github.head_ref == 'master' || github.ref == 'refs/heads/master' }} has_gitflow_label: @@ -123,6 +127,7 @@ jobs: runs-on: ubuntu-20.04 timeout-minutes: 15 if: | + (needs.job_get_metadata.outputs.changed_any_code) && (needs.job_get_metadata.outputs.is_gitflow_sync == 'false' && needs.job_get_metadata.outputs.has_gitflow_label == 'false') steps: - name: Check out base commit (${{ github.event.pull_request.base.sha }}) @@ -274,7 +279,7 @@ jobs: job_check_format: name: Check file formatting - needs: [job_get_metadata, job_build] + needs: [job_get_metadata] timeout-minutes: 10 runs-on: ubuntu-20.04 steps: @@ -282,16 +287,29 @@ jobs: uses: actions/checkout@v4 with: ref: ${{ env.HEAD_COMMIT }} + - name: Set up Node uses: actions/setup-node@v4 with: node-version-file: 'package.json' + + # we use a hash of yarn.lock as our cache key, because if it hasn't changed, our dependencies haven't changed, + # so no need to reinstall them + - name: Compute dependency cache key + id: compute_lockfile_hash + run: echo "hash=${{ hashFiles('yarn.lock', '**/package.json') }}" >> "$GITHUB_OUTPUT" + - name: Check dependency cache - uses: actions/cache/restore@v4 + uses: actions/cache@v4 + id: cache_dependencies with: path: ${{ env.CACHED_DEPENDENCY_PATHS }} - key: ${{ needs.job_build.outputs.dependency_cache_key }} - fail-on-cache-miss: true + key: ${{ steps.compute_lockfile_hash.outputs.hash }} + + - name: Install dependencies + if: steps.cache_dependencies.outputs.cache-hit != 'true' + run: yarn install --ignore-engines --frozen-lockfile + - name: Check file formatting run: yarn lint:prettier && yarn lint:biome