Skip to content

chore(bors): merge pull request #564 #3166

chore(bors): merge pull request #564

chore(bors): merge pull request #564 #3166

Workflow file for this run

name: Lint Commit Messages
on:
pull_request:
types: ['opened', 'edited', 'reopened', 'synchronize']
push:
branches:
- staging
jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
env:
checkout_token: ${{ secrets.ORG_CI_GITHUB }}
if: ${{ env.checkout_token == '' }}
with:
fetch-depth: 0
submodules: recursive
- uses: actions/checkout@v4
env:
checkout_token: ${{ secrets.ORG_CI_GITHUB }}
if: ${{ env.checkout_token != '' }}
with:
fetch-depth: 0
submodules: recursive
token: ${{ secrets.ORG_CI_GITHUB }}
- name: Install CommitLint and Dependencies
run: npm install @commitlint/config-conventional @commitlint/cli
- name: Lint Commits
env:
GH_TOKEN: ${{ github.token }}
run: |
# Only run for PR's and simply succeed the bors staging branch
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)"
ignore_dups="$(gh pr view ${{ github.event.pull_request.number }} --json labels -q .labels.[].name | grep -w 'ignore duplicate commits' || true)"
if [ -z "$ignore_dups" ]; then
if [ "$duplicates" != "" ]; then
echo -e "Duplicate commits found:\n$duplicates" >&2
exit 1
fi
fi
fi