From 9a96e5b515b5f8eb61b2488cc9e6fe52f9854240 Mon Sep 17 00:00:00 2001
From: Philipp Stadler <hello@phstadler.com>
Date: Thu, 18 Jul 2024 10:35:22 +0200
Subject: [PATCH] fix: fetch cliff config in extra command

---
 .gitlab-ci.yml | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index c69e80d..bcc20c8 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -23,18 +23,36 @@ build:
     reports:
       dotenv: build.env
 
+# fetch config files that are the same for all packs, e.g. git-cliff
+fetch-configs:
+  stage: build
+  rules:
+    - if: $CI_COMMIT_TAG
+  variables:
+    # we just need the artifacts and don't need up-to-date source, so don't even fetch
+    GIT_STRATEGY: none
+  # we don't need anything in node_modules or python, so don't fetch the cache
+  cache: []
+  script:
+    - 'curl -H "PRIVATE-TOKEN: $COMMON_CI_API_TOKEN" "https://gitlab.phaidra.org/api/v4/projects/1469/repository/files/cliff.toml/raw/?ref=main" > cliff.toml'
+  artifacts:
+    paths:
+      - cliff.toml
+
 changelog:
   image:
     name: orhunp/git-cliff:latest
     entrypoint: [""]
   rules:
     - if: $CI_COMMIT_TAG
+  needs:
+  - job: fetch-configs
+    artifacts: true
   variables:
     GIT_STRATEGY: clone # clone entire repo instead of reusing workspace
     GIT_DEPTH: 0 # avoid shallow clone to give cliff all the info it needs
   stage: build
   script:
-    - 'curl -H "PRIVATE-TOKEN: $COMMON_CI_API_TOKEN" "https://gitlab.phaidra.org/api/v4/projects/1469/repository/files/cliff.toml/raw/?ref=main" > cliff.toml'
     - git-cliff --latest -o CHANGELOG.md
   artifacts:
     paths:
-- 
GitLab