From 44122d4e08a409f0e80b62cd5ffe147ebfeb8cce Mon Sep 17 00:00:00 2001 From: Harshal Sheth Date: Wed, 27 Jul 2022 01:04:57 +0000 Subject: [PATCH] refactor(ci): use custom action for checking codegen status (#5493) --- .../actions/ensure-codegen-updated/action.yml | 16 ++++++++++++++++ .github/workflows/build-and-test.yml | 10 +--------- .github/workflows/metadata-io.yml | 10 +--------- 3 files changed, 18 insertions(+), 18 deletions(-) create mode 100644 .github/actions/ensure-codegen-updated/action.yml diff --git a/.github/actions/ensure-codegen-updated/action.yml b/.github/actions/ensure-codegen-updated/action.yml new file mode 100644 index 0000000000..0e501bda11 --- /dev/null +++ b/.github/actions/ensure-codegen-updated/action.yml @@ -0,0 +1,16 @@ +name: 'Ensure codegen is updated' +description: 'Will check the local filesystem against git, and abort if there are uncommitted changes.' + +runs: + using: "composite" + steps: + - shell: bash + run: | + if output=$(git status --porcelain) && [ ! -z "$output" ]; then + # See https://unix.stackexchange.com/a/155077/378179. + echo 'There are uncommitted changes:' + echo $output + exit 1 + else + echo 'All good!' + fi diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 4e556e6361..fc6126e134 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -48,15 +48,7 @@ jobs: **/build/test-results/test/** **/junit.*.xml - name: Ensure codegen is updated - run: | - if output=$(git status --porcelain) && [ ! -z "$output" ]; then - # See https://unix.stackexchange.com/a/155077/378179. - echo 'There are uncommitted changes:' - echo $output - exit 1 - else - echo 'All good!' - fi + uses: ./.github/actions/ensure-codegen-updated - name: Slack failure notification if: failure() && github.event_name == 'push' uses: kpritam/slack-job-status-action@v1 diff --git a/.github/workflows/metadata-io.yml b/.github/workflows/metadata-io.yml index 807e14319d..fd0d8dc89d 100644 --- a/.github/workflows/metadata-io.yml +++ b/.github/workflows/metadata-io.yml @@ -51,15 +51,7 @@ jobs: **/build/test-results/test/** **/junit.*.xml - name: Ensure codegen is updated - run: | - if output=$(git status --porcelain) && [ ! -z "$output" ]; then - # See https://unix.stackexchange.com/a/155077/378179. - echo 'There are uncommitted changes:' - echo $output - exit 1 - else - echo 'All good!' - fi + uses: ./.github/actions/ensure-codegen-updated event-file: runs-on: ubuntu-latest