From dfe4459c5cadd465dec4ea860580ecf82b2b8860 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Orhun=20Parmaks=C4=B1z?= Date: Thu, 26 Sep 2024 11:23:56 +0300 Subject: [PATCH] docs(website): add get_env filter example for GitLab CI --- website/docs/integration/gitlab.md | 10 ++++++++++ website/docs/tips-and-tricks.md | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/website/docs/integration/gitlab.md b/website/docs/integration/gitlab.md index 1db4f64da2..5ca6b28a92 100644 --- a/website/docs/integration/gitlab.md +++ b/website/docs/integration/gitlab.md @@ -94,6 +94,16 @@ For example: https://gitlab.com/{{ remote.gitlab.owner }}/{{ remote.gitlab.repo }}/-/tags/{{ version }} ``` +:::tip + +If you are using GitLab CI, you can use [`CI_PROJECT_URL`](https://docs.gitlab.com/ee/ci/variables/predefined_variables.html) environment variable instead: + +```jinja2 +{{ get_env(name="CI_PROJECT_URL") }}/-/tags/{{ version }} +``` + +::: + ### Commit authors For each commit, GitLab related values are added as a nested object (named `gitlab`) to the [template context](/docs/templating/context): diff --git a/website/docs/tips-and-tricks.md b/website/docs/tips-and-tricks.md index 59960d08ce..8bb851512e 100644 --- a/website/docs/tips-and-tricks.md +++ b/website/docs/tips-and-tricks.md @@ -84,3 +84,9 @@ commit_parsers = [ { field = "github.pr_labels", pattern = ".*", group = " 🌀 Miscellaneous" }, ] ``` + +## Use GitLab CI variables + +```jinja2 +{{ get_env(name="CI_PROJECT_URL") }}/-/tags/{{ version }} +```