Skip to content

Commit

Permalink
fix: replace deprecated gitlab ci var (#1404)
Browse files Browse the repository at this point in the history
* 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

* Update src/drivers/gitlab.js

* ci: add expires_at in gitlab credentials

---------

Co-authored-by: Daniel Barnes <[email protected]>
  • Loading branch information
nipierre and dacbd authored Jul 26, 2023
1 parent 5357616 commit f050c11
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gitlab.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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!
"
Expand Down
5 changes: 4 additions & 1 deletion src/drivers/gitlab.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit f050c11

Please sign in to comment.