From 11b75b64176c637ad489d74e07628dff94ecc197 Mon Sep 17 00:00:00 2001 From: Bryant Finney Date: Thu, 21 Dec 2023 21:29:49 -0500 Subject: [PATCH] ci(bryant-finney/pyspry#49): consolidate triggers define both in a single workflow file Signed-off-by: Bryant Finney --- .github/workflows/docker-build.yml | 12 +++++- .github/workflows/pr.yml | 64 ------------------------------ .github/workflows/protected.yml | 13 ------ 3 files changed, 11 insertions(+), 78 deletions(-) delete mode 100644 .github/workflows/pr.yml delete mode 100644 .github/workflows/protected.yml diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 5ea3136..94226b2 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -6,7 +6,17 @@ name: 🐳 Docker on: - workflow_call: + pull_request: + paths: + - .github/workflows/docker-build.yml + - Dockerfile + - docker-compose.yml + - platforms.yml + - poetry.lock + + push: + tags: v* + branches: [main] # ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml deleted file mode 100644 index 68ec83a..0000000 --- a/.github/workflows/pr.yml +++ /dev/null @@ -1,64 +0,0 @@ -# Summary: define a CI/CD pipelines to run on PRs -name: ⬅️ PR Checks - -on: - pull_request: - paths: - - .github/workflows/docker-build.yml - - Dockerfile - - docker-compose.yml - - platforms.yml - - poetry.lock - -jobs: - changes: - # identify types of files that have changed in this PR - - name: 🔎 Check for changes - env: - # these types of files should all impact image builds - DOCKER_FILES: |- - .github/workflows/docker-build.yml - Dockerfile - docker-compose.yml - platforms.yml - poetry.lock - - TYPES_DIR: /tmp/types - - outputs: - docker: ${{ steps.compare.outputs.docker }} - - runs-on: ubuntu-latest - steps: - - name: 📂 Checkout - uses: actions/checkout@v4 - - - name: 📐 Setup - run: | - mkdir -p $TYPES_DIR - printf "%s\n" "${{ env.DOCKER_FILES }}" | sort >$TYPES_DIR/docker-files.txt - - - name: 📝 List changes - env: - GH_TOKEN: ${{ github.token }} - run: gh pr diff --name-only ${{ github.event.number }} | sort >/tmp/changes.txt - - - name: ❔ Compare - id: compare - run: | - for type_path in $TYPES_DIR/*.txt; do - type_name="$(basename "$type_path" | rev | cut -d- -f2- | rev)" - - comm -12 $type_path /tmp/changes.txt | xargs -I{} test -z "{}" || - echo "${type_name}=true" >>"$GITHUB_OUTPUT" - done - - call-docker-build: - if: needs.changes.outputs.docker == 'true' - needs: changes - - permissions: - packages: write - - uses: ./.github/workflows/docker-build.yml diff --git a/.github/workflows/protected.yml b/.github/workflows/protected.yml deleted file mode 100644 index b3b9350..0000000 --- a/.github/workflows/protected.yml +++ /dev/null @@ -1,13 +0,0 @@ -# Summary: define a CI/CD pipeline to run on protected refs -on: - push: - tags: v* - branches: - - main - -jobs: - call-docker-build: - permissions: - packages: write - - uses: ./.github/workflows/docker-build.yml