From 0ee2287b16713a5088f6c34fec9a67f229f561e9 Mon Sep 17 00:00:00 2001 From: Jef LeCompte Date: Wed, 12 Feb 2025 13:59:48 -0800 Subject: [PATCH] fix: fail missing scope Fixes #228 --- .github/dependabot.yaml | 10 ---------- .github/hooks/pre-commit | 3 --- .github/workflows/ci.yaml | 25 +++++++------------------ .github/workflows/release.yaml | 2 +- package-lock.json | 4 ++-- package.json | 2 +- src/__tests__/lint.test.ts | 4 ++++ src/lint.ts | 2 +- 8 files changed, 16 insertions(+), 36 deletions(-) delete mode 100644 .github/dependabot.yaml delete mode 100755 .github/hooks/pre-commit diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml deleted file mode 100644 index 6ebae6b..0000000 --- a/.github/dependabot.yaml +++ /dev/null @@ -1,10 +0,0 @@ -version: 2 -updates: - - package-ecosystem: "github-actions" - directory: "/" - schedule: - interval: "daily" - - package-ecosystem: "npm" - directory: "/" - schedule: - interval: "daily" diff --git a/.github/hooks/pre-commit b/.github/hooks/pre-commit deleted file mode 100755 index 24ce9ab..0000000 --- a/.github/hooks/pre-commit +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -npm run test diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3ea673f..0c60392 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -3,29 +3,18 @@ on: pull_request: branches: - main - push: - branches: - - main jobs: - build-lint: - name: Build and lint + build_test_lint: + name: Build, test, and lint runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Node.js - uses: actions/setup-node@v3 - with: - node-version: "16" - - name: Setup build cache - uses: actions/cache@v3 + uses: actions/setup-node@v4 with: - path: '**/node_modules' - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} - restore-keys: ${{ runner.os }}-node- + node-version-file: package.json - name: Install dependencies run: npm ci - - name: Compile TypeScript - run: npm run compile - - name: Run linter - run: npm run lint + - name: Test + run: npm run test diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index f406c4c..9c4f556 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -4,7 +4,7 @@ on: branches: - main jobs: - build-tag-release: + build_tag_release: name: Build, tag, and release runs-on: ubuntu-latest steps: diff --git a/package-lock.json b/package-lock.json index 5954361..bb746db 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@jef/conventional-commits-pr-action", - "version": "1.3.0", + "version": "1.2.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@jef/conventional-commits-pr-action", - "version": "1.3.0", + "version": "1.2.0", "dependencies": { "@actions/core": "^1.11.1", "@actions/github": "^6.0.0", diff --git a/package.json b/package.json index d910da0..0b2984a 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,6 @@ "typescript": "^5.7.2" }, "volta": { - "node": "20.18.1" + "node": "20.18.3" } } diff --git a/src/__tests__/lint.test.ts b/src/__tests__/lint.test.ts index 04c5bef..9b20a8f 100644 --- a/src/__tests__/lint.test.ts +++ b/src/__tests__/lint.test.ts @@ -34,6 +34,10 @@ describe('lintPullRequest tests', () => { {args: 'feats: test', expected: false}, {args: '(feat): test', expected: false}, {args: 'test', expected: false}, + {args: 'feat(): test', expected: false}, + {args: 'feat:', expected: false}, + {args: 'feat():', expected: false}, + {args: 'feat(test):', expected: false}, ]; tests.forEach(({args, expected}) => { diff --git a/src/lint.ts b/src/lint.ts index fb7c170..6317707 100644 --- a/src/lint.ts +++ b/src/lint.ts @@ -27,7 +27,7 @@ export function getConventionalCommitTypes(): string { export async function lintPullRequest(title: string) { const matches = types.map(type => { - return new RegExp(`^${type}(\\(.*\\))?!?:.*$`); + return new RegExp(`^${type}(\\(.+\\))?!?:.*$`); }); return matches.some(regex => regex.test(title));