thehanimo / pr-title-checker

An action to automatically check if pull request titles conform to Contribution Guidelines

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

After title error and once properly formatted, title checker doesn't re-run and pass.

davidsteelebrady opened this issue · comments

Hi there,

Potentially not understanding usage properly here but to replicate.

  1. Using
    name: PR Title check
    runs-on: ubuntu-latest
    steps:
      - uses: thehanimo/pr-title-checker@v1.2
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

  1. Create a PR with a poorly formatted title.
  2. Title checker correctly identifies issue with title.
    image
  3. Fix title to pass Regex
  4. Pipeline does NOT automatically re-run title checker.

Is there a way to re-run the title checker without having to add to the PR?

commented

Hi! Can you make sure your yaml file looks something like this:

name: "PR Title Checker"
on:
  pull_request:
    types:
      - opened
      - edited
      - synchronize
      - labeled
      - unlabeled

jobs:
  check:
    runs-on: ubuntu-latest
    steps:
      - uses: thehanimo/pr-title-checker@v1.3.1
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

The types under on: pull_request: is what you're missing. In your case of re-naming the title, I think edited is the one you're missing.

Hi @thehanimo Thanks for the quick response. I realised that the code example I added wasn't complete. We are testing for PR but not types. Thanks for the hint. Will report back.

jobs:
  check:
    if: ${{ github.event_name == 'pull_request' }}
    name: PR Title check
    runs-on: ubuntu-latest
    steps:
      - uses: thehanimo/pr-title-checker@v1.2
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

It does make me wonder what the default associated types are that would mean it doesn't fire.

commented

From the docs,

By default, a workflow only runs when a pull_request's activity type is opened, synchronize, or reopened. To trigger workflows for more activity types, use the types keyword.

@thehanimo Yeah I had Edit in place, it turned out to be labelled/unlabeled that resolves it, which makes sense as a label is applied when broken.
Thanks for your help, closing now.

Good action!

commented

@davidsteelebrady I'm glad that helped! But I don't seem to understand why labelled/unlabelled helped? Afaik, in your case, a poorly formatted PR Title was labelled by the action. This title was then "edited" by the user right? Are you sure edited is not what you're looking for?

Also, triggering this on labelled/unlabelled seems redundant. For e.g, a poorly formatted title would initially trigger the action which in turn, labels the PR. This "labelling of the PR" then triggers another redundant check? Is there something I'm missing?