Skip to content

Fix api_token nil error in scripts/api/base.rb

What does this MR do and why?

There is an failed job in JiHu side https://jihulab.com/gitlab-cn/gitlab/-/jobs/6504042

It looks like api_token is nil when call the method empty?.

api_token = options.fetch(:api_token, '')

warn "No API token given." if api_token.empty?

This leads to the following

options = { api_token: nil }

# api_token will be nil
api_token = options.fetch(:api_token, '')

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports