diff --git a/.github/pr-title-checker-config.json b/.github/pr-title-checker-config.json deleted file mode 100644 index 0e850b439d..0000000000 --- a/.github/pr-title-checker-config.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "LABEL": { - "name": "title needs formatting", - "color": "EEEEEE" - }, - "CHECKS": { - "regexp": "^(feat|fix|refactor|chore|docs)(\\(.*\\))?\\!?:.*", - "ignoreLabels" : ["dont-check-PRs-with-this-label", "meta"] - }, - "MESSAGES": { - "success": "All OK", - "failure": "Failing CI test", - "notice": "" - } -} diff --git a/.github/workflows/check-pr-title.yml b/.github/workflows/check-pr-title.yml index 2fdf4d52ad..fc69718a43 100644 --- a/.github/workflows/check-pr-title.yml +++ b/.github/workflows/check-pr-title.yml @@ -15,22 +15,23 @@ # specific language governing permissions and limitations # under the License. -name: "PR Title Checker" +name: Check PR Title + on: - pull_request_target: - types: - - opened - - edited - - synchronize - - labeled - - unlabeled + pull_request: + types: [opened, edited, synchronize, reopened] jobs: - check: + check-pr-title: runs-on: ubuntu-latest steps: - - uses: thehanimo/pr-title-checker@v1.4.1 + - name: Check Title + uses: actions/github-script@v5 with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - pass_on_octokit_error: false - configuration_path: .github/pr-title-checker-config.json + script: | + const title = context.payload.pull_request.title; + const regex = /^(feat|fix|docs|refactor|chore)(\(.\+\))?!?: .+$/; + if (!regex.test(title)) { + core.setFailed('PR title does not follow the convention, the pattern: ^(feat|fix|docs|refactor|chore)(\(.\+\))?!?: .+$'); + } + github-token: ${{ secrets.GITHUB_TOKEN }}