From 9ad73eb9c19bb7f79942e7c1dfb5b75f7953cb9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Kautler?= Date: Mon, 12 Aug 2024 13:46:50 +0200 Subject: [PATCH] Improve all-workflows consistency check --- .github/workflows/branches-and-prs.main.kts | 13 ++++++++++--- .github/workflows/branches-and-prs.yml | 11 ++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.github/workflows/branches-and-prs.main.kts b/.github/workflows/branches-and-prs.main.kts index 849dac6f68..b1e519b4b3 100755 --- a/.github/workflows/branches-and-prs.main.kts +++ b/.github/workflows/branches-and-prs.main.kts @@ -56,7 +56,7 @@ workflow( ) { job( id = "check_all_workflow_yaml_consistency", - name = "Check all Workflow YAML consistency", + name = "Check all Workflow YAML Consistency", runsOn = UbuntuLatest ) { uses( @@ -64,8 +64,15 @@ workflow( action = Checkout() ) run( - name = "Regenerate all workflow YAMLs and check for modifications", - command = """find .github/workflows -mindepth 1 -maxdepth 1 -name "*.main.kts" | xargs -ri sh -c '{} && git diff --exit-code'""" + name = "Regenerate all Workflow YAMLs", + command = """find .github/workflows -mindepth 1 -maxdepth 1 -name '*.main.kts' -exec {} \;""" + ) + run( + name = "Check for Modifications", + command = """ + git add --intent-to-add . + git diff --exit-code + """.trimIndent() ) } diff --git a/.github/workflows/branches-and-prs.yml b/.github/workflows/branches-and-prs.yml index 251d67e7e5..11187c2024 100644 --- a/.github/workflows/branches-and-prs.yml +++ b/.github/workflows/branches-and-prs.yml @@ -28,7 +28,7 @@ jobs: name: 'Consistency check' run: 'git diff --exit-code ''.github/workflows/branches-and-prs.yml''' check_all_workflow_yaml_consistency: - name: 'Check all Workflow YAML consistency' + name: 'Check all Workflow YAML Consistency' runs-on: 'ubuntu-latest' needs: - 'check_yaml_consistency' @@ -37,8 +37,13 @@ jobs: name: 'Checkout Repository' uses: 'actions/checkout@v4' - id: 'step-1' - name: 'Regenerate all workflow YAMLs and check for modifications' - run: 'find .github/workflows -mindepth 1 -maxdepth 1 -name "*.main.kts" | xargs -ri sh -c ''{} && git diff --exit-code''' + name: 'Regenerate all Workflow YAMLs' + run: 'find .github/workflows -mindepth 1 -maxdepth 1 -name ''*.main.kts'' -exec {} \;' + - id: 'step-2' + name: 'Check for Modifications' + run: |- + git add --intent-to-add . + git diff --exit-code build-and-verify: name: 'Build and Verify' runs-on: '${{ matrix.os }}'