Code Issues Pull Requests Actions Packages Projects Releases 15 Wiki Activity Security Code Quality

ci: Replace Node.js setup with Bun for commitlint installation in PR validation workflow

This commit is contained in:
tienbh committed 2026-11-27 10:58:12 +07:00 Verified
1 parent e4f17e435a
commit adf7460b45
1 file changed
+6 -11
@@ -8,9 +8,6 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }} group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true cancel-in-progress: true
env:
NODE_VERSION: '24'
jobs: jobs:
lint-commits-and-pr: lint-commits-and-pr:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -40,13 +37,11 @@ jobs:
curl --silent --show-error --fail --location --output commitlint.config.js "$url" curl --silent --show-error --fail --location --output commitlint.config.js "$url"
echo "config=commitlint.config.js" >> "$GITHUB_OUTPUT" echo "config=commitlint.config.js" >> "$GITHUB_OUTPUT"
- name: Setup Node.js - name: Setup Bun
uses: actions/setup-node@v4 uses: oven-sh/setup-bun@v2
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install commitlint - name: Install commitlint
run: npm install --no-save @commitlint/cli @commitlint/config-conventional run: bun add --no-save @commitlint/cli @commitlint/config-conventional
- name: Validate PR Title & Description (<= 500 chars) - name: Validate PR Title & Description (<= 500 chars)
env: env:
@@ -55,9 +50,9 @@ jobs:
COMMITLINT_CONFIG: ${{ steps.commitlint-config.outputs.config }} COMMITLINT_CONFIG: ${{ steps.commitlint-config.outputs.config }}
run: | run: |
if [ -z "$PR_BODY" ]; then if [ -z "$PR_BODY" ]; then
printf "%s\n" "$PR_TITLE" | npx commitlint --config "$COMMITLINT_CONFIG" printf "%s\n" "$PR_TITLE" | bunx commitlint --config "$COMMITLINT_CONFIG"
else else
printf "%s\n\n%s\n" "$PR_TITLE" "$PR_BODY" | npx commitlint --config "$COMMITLINT_CONFIG" printf "%s\n\n%s\n" "$PR_TITLE" "$PR_BODY" | bunx commitlint --config "$COMMITLINT_CONFIG"
fi fi
- name: Validate All Commits in PR - name: Validate All Commits in PR
@@ -66,4 +61,4 @@ jobs:
HEAD_SHA: ${{ github.event.pull_request.head.sha }} HEAD_SHA: ${{ github.event.pull_request.head.sha }}
COMMITLINT_CONFIG: ${{ steps.commitlint-config.outputs.config }} COMMITLINT_CONFIG: ${{ steps.commitlint-config.outputs.config }}
run: | run: |
npx commitlint --from "$BASE_SHA" --to "$HEAD_SHA" --verbose --config "$COMMITLINT_CONFIG" bunx commitlint --from "$BASE_SHA" --to "$HEAD_SHA" --verbose --config "$COMMITLINT_CONFIG"