Skip unnessary workflow checks (#2872)

Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
This commit is contained in:
Christian Mesh
2025-05-28 11:30:06 -04:00
committed by GitHub
parent 32fe919968
commit 531ade9d35
3 changed files with 69 additions and 11 deletions

View File

@@ -32,9 +32,25 @@ permissions:
contents: read
jobs:
fileschanged:
name: List files changed for pull request
runs-on: ubuntu-latest
steps:
- name: "Fetch source code"
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- id: diff
run: |
echo "Comparing head_commit ${{github.event.push.head_commit}} to base_ref ${{github.event.push.base_ref}}"
git fetch --no-tags --prune --no-recurse-submodules --depth=1 origin ${{github.event.pull_request.base.ref}}
echo "go=$(git diff --name-only origin/${{github.event.pull_request.base.ref}} | grep '\.go' | wc -l)" | tee -a "$GITHUB_OUTPUT"
outputs:
go: ${{ steps.diff.outputs.go }}
unit-tests:
name: Unit tests for ${{ matrix.goos }}_${{ matrix.goarch }}
runs-on: ${{ matrix.runson }}
needs: fileschanged
if: ${{ needs.fileschanged.outputs.go != 0}}
env:
TF_APPEND_USER_AGENT: Integration-Test
GOOS: ${{ matrix.goos }}
@@ -88,6 +104,8 @@ jobs:
race-tests:
name: "Race Tests"
runs-on: ubuntu-latest
needs: fileschanged
if: ${{ needs.fileschanged.outputs.go != 0}}
steps:
- name: "Fetch source code"
@@ -126,6 +144,8 @@ jobs:
# that might leak through this.
name: "End-to-end Tests"
runs-on: ubuntu-latest
needs: fileschanged
if: ${{ needs.fileschanged.outputs.go != 0}}
steps:
- name: "Fetch source code"
@@ -158,6 +178,8 @@ jobs:
consistency-checks:
name: "Code Consistency Checks"
runs-on: ubuntu-latest
needs: fileschanged
if: ${{ needs.fileschanged.outputs.go != 0}}
steps:
- name: "Fetch source code"
@@ -266,14 +288,3 @@ jobs:
with:
path: ".licensei.cache"
key: licensei-cache-${{ hashFiles('go.sum') }}
installation-instructions:
name: "Test Installation Instructions"
runs-on: ubuntu-latest
steps:
- name: "Fetch source code"
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: "Run Installation Instructions Test"
run: make test-linux-install-instructions

View File

@@ -10,9 +10,25 @@ on:
pull_request:
jobs:
fileschanged:
name: List files changed for pull request
runs-on: ubuntu-latest
steps:
- name: "Fetch source code"
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- id: diff
run: |
echo "Comparing head_commit ${{github.event.push.head_commit}} to base_ref ${{github.event.push.base_ref}}"
git fetch --no-tags --prune --no-recurse-submodules --depth=1 origin ${{github.event.pull_request.base.ref}}
echo "go=$(git diff --name-only origin/${{github.event.pull_request.base.ref}} | grep '\.go' | wc -l)" | tee -a "$GITHUB_OUTPUT"
outputs:
go: ${{ steps.diff.outputs.go }}
compare:
name: Compare
runs-on: ubuntu-latest
needs: fileschanged
if: ${{ needs.fileschanged.outputs.go != 0}}
steps:
- name: Checkout

View File

@@ -10,9 +10,27 @@ on:
- 'v[0-9]+.[0-9]+.[0-9]+*'
jobs:
fileschanged:
name: List files changed for pull request
runs-on: ubuntu-latest
steps:
- name: "Fetch source code"
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- id: diff
run: |
echo "Comparing current commit to base ref origin/${{github.event.pull_request.base.ref}}"
git fetch --no-tags --prune --no-recurse-submodules --depth=1 origin ${{github.event.pull_request.base.ref}}
echo "install=$(git diff --name-only origin/${{github.event.pull_request.base.ref}} | grep 'website/docs/intro/install' | wc -l)" | tee -a "$GITHUB_OUTPUT"
echo "website=$(git diff --name-only origin/${{github.event.pull_request.base.ref}} | grep 'website/' | wc -l)" | tee -a "$GITHUB_OUTPUT"
outputs:
install: ${{ steps.diff.outputs.install }}
website: ${{ steps.diff.outputs.website }}
build:
name: Build
runs-on: ubuntu-latest
needs: fileschanged
if: ${{ needs.fileschanged.outputs.website != 0}}
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -24,3 +42,16 @@ jobs:
- name: Build website
run: docker compose -f docker-compose.build.yml up --exit-code-from website
working-directory: website
installation-instructions:
name: "Test Installation Instructions"
runs-on: ubuntu-latest
needs: fileschanged
if: ${{ needs.fileschanged.outputs.install != 0}}
steps:
- name: "Fetch source code"
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: "Run Installation Instructions Test"
run: make test-linux-install-instructions