Bug in latest change to the secret-detection template

Summary

The secret detection template skips running even when the CI_COMMIT_TAG variable is empty.

Steps to reproduce

In a CI pipeline, include the template, verify there is no CI_COMMIT_TAG variable defined.

Example Project

What is the current bug behavior?

There is no CI_COMMIT_TAG variable, yet the secret detection itself inside the job is skipped.

$ if [[ $CI_COMMIT_TAG ]]; echo "Skipping Secret Detection for tags. No code changes have occurred."; then exit 0; fi
Skipping Secret Detection for tags. No code changes have occurred.
...
Job succeeded

What is the expected correct behavior?

The secret detection should run.

Relevant logs and/or screenshots

Output of checks

Results of GitLab environment info

GitLab.com

GitLab Enterprise Edition 13.8.0-pre 92c36c07579

Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)

(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes

Edited by Vicken Simonian