Skip to content

Commit

Permalink
feat(commitlint): ensure upstream/master uses main repo URL
Browse files Browse the repository at this point in the history
Avoid using `${CI_PROJECT_URL}` (the local repo's URL) since that leads
to `upstream/master` only pointing to the local repo's `master` branch,
which could be many commits behind, resulting in spurious `commitlint`
failures.
  • Loading branch information
myii committed Dec 20, 2020
1 parent 15898a3 commit d8dbeb2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ commitlint:
image: *image_commitlint
script:
# Add `upstream` remote to get access to `upstream/master`
- 'git remote add upstream ${CI_PROJECT_URL}.git'
- 'git remote add upstream
https://gitlab.com/myii/ssf-formula.git'
- 'git fetch --all'
# Set default commit hashes for `--from` and `--to`
- 'export COMMITLINT_FROM="$(git merge-base upstream/master HEAD)"'
Expand Down
4 changes: 2 additions & 2 deletions ssf/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ ssf_node_anchors:
# An alternative method could be to use:
# `git describe --abbrev=0 --tags`
# yamllint disable rule:line-length rule:quoted-strings
title: "ci(gitlab-ci): add '`'rubocop'`' linter (with '`'allow_failure'`') [skip ci]"
body: '* Automated using https://github.com/myii/ssf-formula/pull/277'
title: "ci(commitlint): ensure '`'upstream/master'`' uses main repo URL [skip ci]"
body: '* Automated using https://github.com/myii/ssf-formula/pull/278'
# yamllint enable rule:line-length rule:quoted-strings
github:
owner: 'saltstack-formulas'
Expand Down
3 changes: 2 additions & 1 deletion ssf/files/default/.gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ commitlint:
image: *image_commitlint
script:
# Add `upstream` remote to get access to `upstream/master`
- 'git remote add upstream ${CI_PROJECT_URL}.git'
- 'git remote add upstream
https://gitlab.com/{{ gitlab.owner }}/{{ gitlab.repo or formula }}.git'
- 'git fetch --all'
# Set default commit hashes for `--from` and `--to`
- 'export COMMITLINT_FROM="$(git merge-base upstream/master HEAD)"'
Expand Down

0 comments on commit d8dbeb2

Please sign in to comment.