Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/time-to-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ on:
pull_request:
types: [opened, synchronize]

permissions:
pull-requests: read
issues: write

jobs:
time-to-review:
runs-on: ubuntu-latest
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/validate-commits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ on:
pull_request:
types: [opened, synchronize, reopened]

permissions:
contents: read
pull-requests: write

jobs:
validate-commits:
runs-on: ubuntu-latest
Expand Down
12 changes: 11 additions & 1 deletion commit-message-validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,17 @@ async function run() {
try {
// Get inputs from workflow
const token = core.getInput('github-token', { required: true });
const pattern = core.getInput('pattern') || '^((Merge[ a-z-]* branch.*)|(Revert*)|((build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\(.*\))?!?: .*))$';

const mergeBranchPattern = "Merge branch '[^']+' into [^\\s]+";
Copy link

Copilot AI Sep 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The merge branch pattern uses single quotes around the branch name but doesn't account for Git's default merge messages which use double quotes. Consider using \"Merge branch '[^']+' into [^\\s]+\" or make it more flexible to handle both quote styles.

Suggested change
const mergeBranchPattern = "Merge branch '[^']+' into [^\\s]+";
const mergeBranchPattern = 'Merge branch [\'"][^\'"]+[\'"] into [^\\s]+';

Copilot uses AI. Check for mistakes.
const revertPattern = 'Revert ".*"';
const createPrPattern = 'Create PR for #\\d+';
const types = [
'feat', 'fix', 'chore', 'docs', 'style', 'refactor', 'perf', 'test', 'build', 'ci', 'revert'
].join('|');
const conventionalPattern = `(?:(${types})(\\([a-z0-9\\-]+\\))?: .*)`;
Comment thread
srajasimman marked this conversation as resolved.
Outdated

const defaultPattern = `^(${mergeBranchPattern}|${revertPattern}|${createPrPattern}|${conventionalPattern})$`;
Comment thread
srajasimman marked this conversation as resolved.
Outdated
const pattern = core.getInput('pattern') || defaultPattern;
const regexPattern = new RegExp(pattern);

// Create octokit client
Expand Down
Loading