summaryrefslogtreecommitdiff
path: root/javascript/videojs/.github/actions/pr-titles.mjs
blob: 6712d48268e48092628384b425619e0db5c97626 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
import * as core from '@actions/core';
import * as github from '@actions/github';

(async function run() {
  const title = github.context.payload.pull_request?.title;
  const titleRegex = /^(chore|ci|docs|feat|fix|refactor|revert|test)(\(.+\))?!?: (.+)/;

  if (!!title.match(titleRegex)) {
    core.info('Pull request title is OK');
  } else {
    core.setFailed('Please use conventional commit style for the PR title so the merged change appears in the changelog. See https://www.conventionalcommits.org/.');
  }
})();