fix(ci): only run pipeline when scheduled or "Run pipeline" in the main branch

This commit is contained in:
MDLeom 2022-01-11 06:38:43 +00:00
parent c7ca26a35d
commit 41d3cd65ad
No known key found for this signature in database
GPG Key ID: 32D3E28E96A695E8
1 changed files with 5 additions and 4 deletions

View File

@ -3,6 +3,11 @@ image: alpine:latest
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")'