Skip to content

ci: use MR project ID in commitlint script

Tomas Vik (OOO back on 2025-01-02) requested to merge fix-mr-commit-lint into main

The script is responsible for requesting MR details and validating the MR title in the case the title is used as squashed MR commit message. The API URL needs project ID but we weren't using the correct ID.

MR target project forked project
project ID CI_MERGE_REQUEST_PROJECT_ID CI_PROJECT_ID
MR ID CI_MERGE_REQUEST_IID

By using CI_PROJECT_ID the script didn't work in forked repositories.

Originally the script used CI_PROJECT_ID but that variable might point to a forked project. The forked project is sometimes not the target of the MR.

Now the CI_MERGE_REQUEST_PROJECT_ID always points to the project with the MR CI_MERGE_REQUEST_IID.

See the following URL for CI variable documentation: https://docs.gitlab.com/ee/ci/variables/predefined_variables.html

Relates to #198 (closed)

Edited by Tomas Vik (OOO back on 2025-01-02)

Merge request reports

Loading