Skip to content

Commit

Permalink
Verify consistency of all workflow YAMLs on pull requests and branches
Browse files Browse the repository at this point in the history
  • Loading branch information
Vampire committed Apr 17, 2023
1 parent 5817f17 commit d5710b8
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/branches-and-prs.main.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import io.github.typesafegithub.workflows.actions.codecov.CodecovActionV3
import io.github.typesafegithub.workflows.actions.gradle.GradleBuildActionV2
import io.github.typesafegithub.workflows.domain.Concurrency
import io.github.typesafegithub.workflows.domain.RunnerType
import io.github.typesafegithub.workflows.domain.RunnerType.UbuntuLatest
import io.github.typesafegithub.workflows.domain.actions.Action.Outputs
import io.github.typesafegithub.workflows.domain.actions.LocalAction
import io.github.typesafegithub.workflows.domain.triggers.PullRequest
Expand Down Expand Up @@ -52,6 +53,25 @@ workflow(
cancelInProgress = true
)
) {
job(
id = "check_all_workflow_yaml_consistency",
name = "Check all Workflow YAML consistency",
runsOn = UbuntuLatest
) {
uses(
name = "Checkout Repository",
action = CheckoutV3()
)
run(
name = "Regenerate all workflow YAMLs",
command = """find .github/workflows -mindepth 1 -maxdepth 1 -name "*.main.kts" -exec sh -c {} \;"""
)
run(
name = "Check if some file is different after regeneration",
command = "git diff --exit-code ."
)
}

job(
id = "build-and-verify",
name = "Build and Verify",
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/branches-and-prs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,21 @@ jobs:
- id: step-2
name: Consistency check
run: git diff --exit-code '.github/workflows/branches-and-prs.yaml'
check_all_workflow_yaml_consistency:
name: Check all Workflow YAML consistency
runs-on: ubuntu-latest
needs:
- check_yaml_consistency
steps:
- id: step-0
name: Checkout Repository
uses: actions/checkout@v3
- id: step-1
name: Regenerate all workflow YAMLs
run: find .github/workflows -mindepth 1 -maxdepth 1 -name "*.main.kts" -exec sh -c {} \;
- id: step-2
name: Check if some file is different after regeneration
run: git diff --exit-code .
build-and-verify:
name: Build and Verify
runs-on: ${{ matrix.os }}
Expand Down

0 comments on commit d5710b8

Please sign in to comment.