From 68e5ec1f3e0e8ff8310cb6f31922431f0315b5ca Mon Sep 17 00:00:00 2001
From: Jean-Paul Calderone <exarkun@twistedmatrix.com>
Date: Fri, 22 Jul 2022 13:39:29 -0400
Subject: [PATCH] Run the production update on a schedule, too.

---
 .gitlab-ci.yml | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index a1ac2ba2..87994901 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -14,9 +14,16 @@
 # As above, but rules for running when the scheduler triggers the pipeline.
 .schedule_rules: &RUN_ON_SCHEDULE
   rules:
-    - if: '$CI_PIPELINE_SOURCE == "schedule"'
+    # There are multiple schedules so make sure this one is for us.
+    - if: '$SCHEDULE_TARGET != $CI_JOB_NAME'
+      when: "never"
 
-    - when: "never"
+    # Make sure this is actually a scheduled run
+    - if: '$CI_PIPELINE_SOURCE != "schedule"'
+      when: "never"
+
+    # Conditions look good: run.
+    - when: "always"
 
 stages:
   - "build"
@@ -169,7 +176,8 @@ update-nixpkgs:
               "$CI_DEFAULT_BRANCH"
 
 update-production:
-  <<: *RUN_ON_MERGE_REQUEST
+  <<: *RUN_ON_SCHEDULE
+  stage: "build"
   script:
     - |
       ./ci-tools/update-production \
-- 
GitLab