From 9d63cd69011565f9a521a083197d0d85e22ee1ba Mon Sep 17 00:00:00 2001 From: Ming Di Leom <2809763-curben@users.noreply.gitlab.com> Date: Tue, 11 Jan 2022 06:44:16 +0000 Subject: [PATCH] fix(ci): only run pipeline when scheduled or "Run pipeline" in the main branch --- .github/workflows/pages.yml | 3 --- .gitlab-ci.yml | 9 +++++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 0a07338..fbd304b 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -1,9 +1,6 @@ name: Pages on: - push: - branches: - - main schedule: - cron: "0 0,12 * * *" workflow_dispatch: diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 602b9cc..58ee74f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,6 +3,11 @@ image: node:lts-alpine include: - template: Security/Secret-Detection.gitlab-ci.yml +# Only run pipeline when scheduled or "Run pipeline" in the main branch +workflow: + rules: + - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && ($CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "web")' + build_job: stage: build @@ -41,7 +46,3 @@ deploy_job: script: - curl -X POST -d "{}" "https://api.netlify.com/build_hooks/$NETLIFY_BUILD_HOOK" - curl -X POST "https://api.cloudflare.com/client/v4/pages/webhooks/deploy_hooks/$CLOUDFLARE_BUILD_HOOK" - - rules: - # Only trigger through schedule job and "Run pipeline" in the main branch - - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && ($CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "web")'