diff --git a/.github/workflows/pr-commitlint.yml b/.github/workflows/pr-commitlint.yml index f6e2208e3..61e7f566b 100644 --- a/.github/workflows/pr-commitlint.yml +++ b/.github/workflows/pr-commitlint.yml @@ -12,6 +12,7 @@ jobs: steps: - uses: actions/checkout@v3 with: + submodules: true fetch-depth: 0 - name: Install CommitLint and Dependencies run: npm install @commitlint/config-conventional @commitlint/cli @@ -21,5 +22,14 @@ jobs: if [ ! ${{ github.ref }} = "refs/heads/staging" ]; then first_commit=${{ github.event.pull_request.base.sha }} last_commit=${{ github.event.pull_request.head.sha }} + # Ensure code-review commits don't get merged + sed "s/code-review-rule': \[0/code-review-rule': [2/g" -i commitlint.config.js npx commitlint --from $first_commit --to $last_commit -V + + git log --pretty=format:%s $first_commit..$last_commit > ./subjects + duplicates="$(cat ./subjects | sort | uniq -D)" + if [ "$duplicates" != "" ]; then + echo -e "Duplicate commits found:\n$duplicates" >&2 + exit 1 + fi fi diff --git a/commitlint.config.js b/commitlint.config.js deleted file mode 100644 index 03386415a..000000000 --- a/commitlint.config.js +++ /dev/null @@ -1,11 +0,0 @@ -module.exports = { - extends: ['@commitlint/config-conventional'], - rules: { - 'type-enum': [2, 'always', ['build', 'chore', 'ci', 'docs', 'feat', 'fix', 'perf', 'refactor', 'revert', 'style', 'test', 'example']], - }, - defaultIgnores: false, - ignores: [ - (message) => message.startsWith('chore(bors): merge pull request #'), - (message) => message.startsWith('Merge #') - ] -} diff --git a/commitlint.config.js b/commitlint.config.js new file mode 120000 index 000000000..efb28e555 --- /dev/null +++ b/commitlint.config.js @@ -0,0 +1 @@ +dependencies/control-plane/commitlint.config.js \ No newline at end of file diff --git a/dependencies/control-plane b/dependencies/control-plane index d28c0ea14..6869243c9 160000 --- a/dependencies/control-plane +++ b/dependencies/control-plane @@ -1 +1 @@ -Subproject commit d28c0ea14eb8d475d25c544b4e1ec6d8fe5c48c8 +Subproject commit 6869243c9f17783e7b8bbafe9218975cb18c692e