From 961aa0c911a5728e5f21f38988987053f43bb5c8 Mon Sep 17 00:00:00 2001 From: Fred Adeniyi Date: Sun, 13 Jul 2025 17:23:52 +0800 Subject: [PATCH] feat: Add #skip functionality for deployment and tagging Allows skipping deployment and version tagging for push events when commit message contains #skip. --- .github/workflows/pipeline.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index b68a0da..c2dcd51 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -15,7 +15,7 @@ jobs: - uses: actions/checkout@v4 with: ref: part11-ci-cd-systems - + - uses: actions/setup-node@v4 with: node-version: '20' @@ -35,14 +35,14 @@ jobs: - name: Run Tests run: npm run test -- --watchAll=false working-directory: part11 - + - name: Install Playwright Browsers run: npx playwright install --with-deps - name: e2e tests run: npm run test:e2e working-directory: part11 - + - uses: actions/upload-artifact@v4 if: ${{ !cancelled() }} with: @@ -51,11 +51,13 @@ jobs: retention-days: 7 - name: Setup flyctl - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/part11-ci-cd-systems' }} + # Skip setup if the commit message contains #skip for push events on the target branch + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/part11-ci-cd-systems' && !contains(github.event.head_commit.message, '#skip') }} uses: superfly/flyctl-actions/setup-flyctl@master - name: Deploy to Fly.io - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/part11-ci-cd-systems' }} + # Skip deployment if the commit message contains #skip for push events on the target branch + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/part11-ci-cd-systems' && !contains(github.event.head_commit.message, '#skip') }} run: flyctl deploy --remote-only -a pokedex-app-6035 env: FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} @@ -64,7 +66,8 @@ jobs: tag_release: needs: [simple_deployment_pipeline] runs-on: ubuntu-24.04 - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/part11-ci-cd-systems' }} + # Skip tagging if the commit message contains #skip for push events on the target branch + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/part11-ci-cd-systems' && !contains(github.event.head_commit.message, '#skip') }} steps: - uses: actions/checkout@v4 with: @@ -76,4 +79,4 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} TAG_PREFIX: v DEFAULT_BUMP: patch - DRY_RUN: "true" + DRY_RUN: "true" \ No newline at end of file