From 2cbddb7a7762cc165a27ad81e0b163e0711e1935 Mon Sep 17 00:00:00 2001 From: nipierre Date: Thu, 20 Jul 2023 18:06:26 +0200 Subject: [PATCH 1/3] fix: replace deprecated gitlab ci var GitLab 16.x deprecated several variables including CI_BUILD_REF_NAME. In order to be exhaustive, two variables are replacing it: CI_COMMIT_BRANCH (prefered) and CI_COMMIT_REF_NAME. Issue: #1403 --- src/drivers/gitlab.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/drivers/gitlab.js b/src/drivers/gitlab.js index f5cb6a7df..92b21f9b1 100644 --- a/src/drivers/gitlab.js +++ b/src/drivers/gitlab.js @@ -530,7 +530,10 @@ class Gitlab { } get branch() { - return process.env.CI_BUILD_REF_NAME; + if ('CI_COMMIT_BRANCH' in process.env) { + return process.env.CI_COMMIT_BRANCH + } + return process.env.CI_COMMIT_REF_NAME; } get userEmail() { From fa42a3bd6feffb238ba05ddd216e95df51cb6825 Mon Sep 17 00:00:00 2001 From: Daniel Barnes Date: Thu, 20 Jul 2023 09:56:02 -0700 Subject: [PATCH 2/3] Update src/drivers/gitlab.js --- src/drivers/gitlab.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/drivers/gitlab.js b/src/drivers/gitlab.js index 92b21f9b1..932964ea6 100644 --- a/src/drivers/gitlab.js +++ b/src/drivers/gitlab.js @@ -531,7 +531,7 @@ class Gitlab { get branch() { if ('CI_COMMIT_BRANCH' in process.env) { - return process.env.CI_COMMIT_BRANCH + return process.env.CI_COMMIT_BRANCH; } return process.env.CI_COMMIT_REF_NAME; } From dc535cc4ec7f540a2a0002227c2e210f67a7cbc1 Mon Sep 17 00:00:00 2001 From: nipierre Date: Fri, 21 Jul 2023 11:12:28 +0200 Subject: [PATCH 3/3] ci: add expires_at in gitlab credentials --- .github/workflows/gitlab.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gitlab.yml b/.github/workflows/gitlab.yml index 56b455fb8..a66e7d61c 100644 --- a/.github/workflows/gitlab.yml +++ b/.github/workflows/gitlab.yml @@ -28,7 +28,7 @@ jobs: ; user.password = '${{ github.token }}' ; user.password_confirmation = '${{ github.token }}' ; user.save! - ; token = user.personal_access_tokens.create(scopes: [:api], name: 'Token') + ; token = user.personal_access_tokens.create(scopes: [:api], name: 'Token', expires_at: 1.days.from_now) ; token.set_token('${{ github.token }}') ; token.save! "