Skip to content

Commit

Permalink
NET-5382: Do not run workflow runs if at least one path matches
Browse files Browse the repository at this point in the history
  • Loading branch information
NiniOak committed Aug 21, 2023
1 parent 6d22179 commit 19a5ab2
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 2 deletions.
28 changes: 27 additions & 1 deletion .github/workflows/go-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,34 @@ env:
GOPRIVATE: github.com/hashicorp # Required for enterprise deps

jobs:
changed_files:
runs-on: ubuntu-latest
name: Test changed-files
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # OR "2" -> To retrieve the preceding commit.

# Example 1
- name: Get all docs, ui and github files that have changed
id: changed-files-yaml
uses: tj-actions/changed-files@v37
with:
files_yaml: |
docs:
- '**/*.md'
- docs/**
- README.md
ui:
- 'ui/**'
- 'website/**'
- 'grafana/**'
github:
- '.github/**'
setup:
name: Setup
if: needs.steps.changed-files-yaml.outputs.test_any_changed == 'false'
runs-on: ubuntu-latest
outputs:
compute-small: ${{ steps.setup-outputs.outputs.compute-small }}
Expand Down Expand Up @@ -487,7 +513,7 @@ jobs:
- go-test-32bit
# - go-test-s390x
runs-on: ${{ fromJSON(needs.setup.outputs.compute-small) }}
if: ${{ always() }}
if: always() && needs.steps.changed-files-yaml.outputs.test_any_changed == 'false'
steps:
- name: evaluate upstream job results
run: |
Expand Down
28 changes: 27 additions & 1 deletion .github/workflows/test-integrations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,35 @@ env:
GOPRIVATE: github.com/hashicorp # Required for enterprise deps

jobs:
changed_files:
runs-on: ubuntu-latest
name: Test changed-files
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # OR "2" -> To retrieve the preceding commit.

# Example 1
- name: Get all test, doc and src files that have changed
id: changed-files-yaml
uses: tj-actions/changed-files@v37
with:
files_yaml: |
docs:
- '**/*.md'
- docs/**
- README.md
ui:
- 'ui/**'
- 'website/**'
- 'grafana/**'
github:
- '.github/**'
setup:
runs-on: ubuntu-latest
name: Setup
if: needs.steps.changed-files-yaml.outputs.test_any_changed == 'false'
outputs:
compute-small: ${{ steps.runners.outputs.compute-small }}
compute-medium: ${{ steps.runners.outputs.compute-medium }}
Expand Down Expand Up @@ -567,7 +593,7 @@ jobs:
- compatibility-integration-test
- peering_commontopo-integration-test
runs-on: ${{ fromJSON(needs.setup.outputs.compute-small) }}
if: ${{ always() }}
if: always() && needs.steps.changed-files-yaml.outputs.test_any_changed == 'false'
steps:
- name: evaluate upstream job results
run: |
Expand Down

0 comments on commit 19a5ab2

Please sign in to comment.