From bf20382905d6aace79becbcb6cec6a3c3af05c76 Mon Sep 17 00:00:00 2001 From: Justin E <63556914+PillageDev@users.noreply.github.com> Date: Sun, 10 Aug 2025 02:39:36 +0000 Subject: [PATCH] Enhance PR CI workflow by adding conditional checks to skip jobs for staging to production PRs --- .github/workflows/pr.yml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index c3be327..dcc7d7f 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1,8 +1,23 @@ name: PR CI - on: pull_request: types: [opened, synchronize, reopened, ready_for_review] + branches-ignore: + - production + paths-ignore: [] + +jobs: + skip-if-staging-to-production: + if: github.event.pull_request.base.ref == 'production' && github.event.pull_request.head.ref == 'staging' + runs-on: ubuntu-latest + steps: + - run: echo "Skipping PR checks for staging -> production PR." + outputs: + skipped: true + + lint: + if: github.event.pull_request.base.ref != 'production' || github.event.pull_request.head.ref != 'staging' + types: [opened, synchronize, reopened, ready_for_review] # Prevent duplicate runs on same PR head concurrency: @@ -60,6 +75,7 @@ jobs: run: pnpm run lint prebuild: + if: github.event.pull_request.base.ref != 'production' || github.event.pull_request.head.ref != 'staging' name: Prebuild monorepo applications runs-on: ubuntu-latest needs: lint @@ -204,6 +220,7 @@ jobs: retention-days: 3 build-next: + if: github.event.pull_request.base.ref != 'production' || github.event.pull_request.head.ref != 'staging' name: Build Next.js images (prebuilt, no push) runs-on: ubuntu-latest needs: prebuild @@ -257,6 +274,7 @@ jobs: docker image ls $IMAGE:$SHA_TAG build-nitro: + if: github.event.pull_request.base.ref != 'production' || github.event.pull_request.head.ref != 'staging' name: Build nitro-api image (prebuilt, no push) runs-on: ubuntu-latest needs: prebuild @@ -302,6 +320,7 @@ jobs: docker image ls $IMAGE:$SHA_TAG summary: + if: github.event.pull_request.base.ref != 'production' || github.event.pull_request.head.ref != 'staging' name: Summary runs-on: ubuntu-latest needs: [build-next, build-nitro]