Skip to content

Commit

Permalink
chore(ci): use custom action for commitlint
Browse files Browse the repository at this point in the history
  • Loading branch information
poulet42 committed Jan 23, 2024
1 parent c3fae87 commit 4eea3bc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 39 deletions.
39 changes: 1 addition & 38 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,41 +18,4 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install node
uses: actions/setup-node@v4
with:
node-version: 18

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
run_install: false

- name: Set ENV variables
shell: bash
run: |
echo "COMMITLINT_CLI_VERSION=$(pnpm show @commitlint/cli version)" >> $GITHUB_ENV
echo "COMMITLINT_CONFIG_CONVENTIONAL_VERSION=$(pnpm show @commitlint/config-conventional version)" >> $GITHUB_ENV
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v3
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ env.COMMITLINT_CLI_VERSION }}-${{ env.COMMITLINT_CONFIG_CONVENTIONAL_VERSION }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install commitlint
run: |
pnpm install -w @commitlint/cli@$COMMITLINT_CLI_VERSION"
pnpm install -w @commitlint/config-conventional@COMMITLINT_CONFIG_CONVENTIONAL_VERSION"
- name: Validate current commit (last commit) with commitlint
if: github.event_name == 'push'
run: pnpm commitlint --from HEAD~1 --to HEAD --verbose

- name: Validate PR commits with commitlint
if: github.event_name == 'pull_request'
run: pnpm commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose
- uses: wagoid/commitlint-github-action@v5
2 changes: 1 addition & 1 deletion commitlint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ module.exports = {
"body-max-line-length": [2, "always", Infinity],
"footer-leading-blank": [2, "always"],
},
};
};

0 comments on commit 4eea3bc

Please sign in to comment.