thehanimo / pr-title-checker

An action to automatically check if pull request titles conform to Contribution Guidelines
MIT License
109 stars 36 forks source link

Failed to add label to PR in v1.4.0 #43

Closed JBeresford closed 1 year ago

JBeresford commented 1 year ago

We're currently running v1.3.7 of the action and everything is working as expected, however when I upgrade to run with v1.4.0 it fails with the following error:

Using config file .github/pr-title-checker-config.json from repo Owner/Repo [ref: ... ]
Creating label (title needs formatting)...
Label (title needs formatting) already created.
TypeError: Cannot read properties of undefined (reading 'notice')
Error: Failed to add label (title needs formatting) to PR

This is reproducible in the following workflow definition which works at v1.3.7 but fails as soon as I upgrade to v1.4.0

name: PR Title Checker

on:
  pull_request:
    types:
      - opened
      - reopened
      - edited
      - synchronize
      - labeled
    branches:
      - feature/*
      - sub-feature/*

jobs:
  pr_title_check:
    name: PR Title Check
    runs-on: windows-latest

    steps:
      - uses: thehanimo/pr-title-checker@v1.4.0
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

The config is as follows:

{
  "LABEL": {
    "name": "title needs formatting",
    "color": "EEEEEE"
  },
  "CHECKS": {
    "regexp": "^((Feature|Sub-Feature) DEV-[0-9]+)|^Bump +"
  }
}
thehanimo commented 1 year ago

Thanks for bringing this up. There was a bug in the code that treated config.MESSAGES as mandatory. Pushed a fix in v1.4.1!