title: Run pre-commit conventional commit check on squash commit before merge into master only
body: <p>I want to run the <a href="https://github.com/commitizen-tools/commitizen" rel="nofollow noreferrer">commitizen</a> (python implementation of conventional commit message enforcement) lint check (<code>cz check</code>) within my GitLab CI pipeline but <strong>ONLY</strong> on the squash commit that precedes a merge into master from a feature branch.</p>
  <p>I can't get my head around how to do this. My understanding/assumption is as follows:</p>
  <ul>
  <li>This is only going to be possible if my merge strategy is merge commit (i.e. not fast forward) because I need there to be a commit that can fail (before the merge into master) so that the merge can then abort - if it was just 1 commit as per fast-forward strategy, it would be too late; the code would already be in master and then the pipeline would fail. Luckily, I am fine with this but I'm curious as to how you would solve for this with fast-forward.</li>
  <li>The squash commit runs on the feature branch which triggers a pipeline.</li>
  <li>If I fail the squash commit pipeline, GitLab CI will not proceed to the merge commit.</li>
  </ul>
  <p>If my assumptions are correct, I would need to detect whether the commit a given pipeline is handling is a squash commit or not - but I can't figure out how to do this - there doesn't seem to be any <em>signal</em> from either gitlab or git that I could use in my pipeline.</p>
  <p>In terms of implementation, I intend to add the <a href="https://github.com/commitizen-tools/commitizen#integrating-with-pre-commit" rel="nofollow noreferrer">pre-commit hook provided by commitizen</a> but I will use <code>stages: [manual]</code> and then within my pipeline, I'll run <code>pre-commit run --hook-stage manual [hookid]</code> as per <a href="https://pre-commit.com/#confining-hooks-to-run-at-certain-stages" rel="nofollow noreferrer">pre-commit docs</a>.</p>