From 893ab12452f50f303fcbfe2539e79d05ed8597b3 Mon Sep 17 00:00:00 2001 From: Zachary Mueller Date: Thu, 23 Jun 2022 16:51:33 -0400 Subject: [PATCH] Auto-build Docker images before on-merge if setup.py was changed (#17573) * Auto-build on setup modification * Modify push-caller * Make adjustments based on code review --- .github/workflows/build-docker-images.yml | 1 + .github/workflows/self-push-caller.yml | 31 +++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/.github/workflows/build-docker-images.yml b/.github/workflows/build-docker-images.yml index 295f668d4d..2d4dfc9f04 100644 --- a/.github/workflows/build-docker-images.yml +++ b/.github/workflows/build-docker-images.yml @@ -5,6 +5,7 @@ on: branches: - docker-image* repository_dispatch: + workflow_call: schedule: - cron: "0 1 * * *" diff --git a/.github/workflows/self-push-caller.yml b/.github/workflows/self-push-caller.yml index c6986ddf28..6dffef5da7 100644 --- a/.github/workflows/self-push-caller.yml +++ b/.github/workflows/self-push-caller.yml @@ -13,9 +13,40 @@ on: - "utils/**" jobs: + check-for-setup: + runs-on: ubuntu-latest + name: Check if setup was changed + outputs: + changed: ${{ steps.was_changed.outputs.changed }} + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: "2" + + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v22.2 + + - name: Was setup changed + id: was_changed + run: | + for file in ${{ steps.changed-files.outputs.all_changed_files }}; do + if [ `basename "${file}"` = "setup.py" ]; then + echo ::set-output name=changed::"1" + fi + done + + build-docker-containers: + needs: check-for-setup + if: (github.event_name == 'push') && (needs.check-for-setup.outputs.changed == '1') + uses: ./.github/workflows/build-docker-images.yml + secrets: inherit + run_push_ci: name: Trigger Push CI runs-on: ubuntu-latest + if: ${{ always() }} + needs: build-docker-containers steps: - name: Trigger push CI via workflow_run run: echo "Trigger push CI via workflow_run" \ No newline at end of file