Skip to content

Commit

Permalink
Use YAML anchors to deduplicate deduplication logic
Browse files Browse the repository at this point in the history
  • Loading branch information
garryod committed Jan 8, 2025
1 parent 6b3933f commit 056673f
Showing 1 changed file with 14 additions and 28 deletions.
42 changes: 14 additions & 28 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,19 @@ on:
jobs:
devcontainer:
# Deduplicate jobs from pull requests and branch pushes within the same repo.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
if: &deduplicate github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
uses: ./.github/workflows/_devcontainer.yaml

bundler_lint:
# Deduplicate jobs from pull requests and branch pushes within the same repo.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
if: *deduplicate
uses: ./.github/workflows/_bundler_lint.yaml

bundler_test:
# Deduplicate jobs from pull requests and branch pushes within the same repo.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
if: *deduplicate
uses: ./.github/workflows/_bundler_test.yaml

bundler_container:
# Deduplicate jobs from pull requests and branch pushes within the same repo.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
if: *deduplicate
needs:
- bundler_lint
- bundler_test
Expand All @@ -32,23 +29,19 @@ jobs:
uses: ./.github/workflows/_bundler_container.yaml

bundler_docs:
# Deduplicate jobs from pull requests and branch pushes within the same repo.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
if: *deduplicate
uses: ./.github/workflows/_bundler_docs.yaml

policy_lint:
# Deduplicate jobs from pull requests and branch pushes within the same repo.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
if: *deduplicate
uses: ./.github/workflows/_policy_lint.yaml

policy_test:
# Deduplicate jobs from pull requests and branch pushes within the same repo.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
if: *deduplicate
uses: ./.github/workflows/_policy_test.yaml

policy_container:
# Deduplicate jobs from pull requests and branch pushes within the same repo.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
if: *deduplicate
needs:
- policy_lint
- policy_test
Expand All @@ -58,48 +51,41 @@ jobs:
uses: ./.github/workflows/_policy_container.yaml

helm_chart_lint:
# Deduplicate jobs from pull requests and branch pushes within the same repo.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
if: *deduplicate
uses: ./.github/workflows/_helm_chart_lint.yaml

helm_chart_publish:
# Deduplicate jobs from pull requests and branch pushes within the same repo.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
if: *deduplicate
needs: helm_chart_lint
permissions:
contents: read
packages: write
uses: ./.github/workflows/_helm_chart_publish.yaml

docs_lint:
# Deduplicate jobs from pull requests and branch pushes within the same repo.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
if: *deduplicate
uses: ./.github/workflows/_docs_lint.yaml

docs_build:
# Deduplicate jobs from pull requests and branch pushes within the same repo.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
if: *deduplicate
uses: ./.github/workflows/_docs_build.yaml

techdocs_publish:
# Deduplicate jobs from pull requests and branch pushes within the same repo.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
if: *deduplicate
needs:
- docs_lint
- docs_build
uses: ./.github/workflows/_techdocs_publish.yaml

pages_build:
# Deduplicate jobs from pull requests and branch pushes within the same repo.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
if: *deduplicate
needs:
- bundler_docs
- docs_lint
- docs_build
uses: ./.github/workflows/_pages_build.yaml

pages_publish:
# Deduplicate jobs from pull requests and branch pushes within the same repo.
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: pages_build
permissions:
Expand Down

0 comments on commit 056673f

Please sign in to comment.