From 169143efb511cff2c97c9c5384b3a7ab0781b1e6 Mon Sep 17 00:00:00 2001
From: Yen-Chen Chen <yen-chen.chen@tum.de>
Date: Fri, 28 Mar 2025 13:18:49 +0000
Subject: [PATCH] Enable Changelog automation for non-latest commits
 (icon-libraries/libfortran-support!117)

## What is the new feature
Make changelog API to search for changelogs until the target commit. This way we can mange the versions more easily.
## How is it implemented
In the GitLab [Changelog API](https://docs.gitlab.com/api/repositories/#generate-changelog-data), the default `from` attribute is the last tag, which is exactly what we wanted. The default `to` attribute is the latest commit at the default branch. We change it to the target commit where we create the tag.

Approved-by: Mikael Stellio <mikael.stellio@c2sm.ethz.ch>
Merged-by: Mikael Stellio <mikael.stellio@c2sm.ethz.ch>
Changelog: other
---
 .gitlab-ci.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 5800594..4252ff1 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -296,7 +296,7 @@ Prepare Changelog:
   script:
     - apk add curl jq
     # generate release note
-    - 'curl -H "PRIVATE-TOKEN: $CI_API_TOKEN" "$CI_API_V4_URL/projects/$CI_PROJECT_ID/repository/changelog?version=$CI_COMMIT_TAG" | jq -r .notes > release_notes.md'
+    - 'curl -H "PRIVATE-TOKEN: $CI_API_TOKEN" "$CI_API_V4_URL/projects/$CI_PROJECT_ID/repository/changelog?version=$CI_COMMIT_TAG&to=$CI_COMMIT_SHA" | jq -r .notes > release_notes.md'
   tags:
     # choose runner
     - alpine
-- 
GitLab