cocogitto / cocogitto-bot

A pedantic conventional commit github bot powered by cocogitto
3 stars 1 forks source link

[BUG] cocogitto-bot not honoring the `ignore_merge_commits` configuration #15

Closed luciidlou closed 10 months ago

luciidlou commented 1 year ago

Describe the bug The cocogitto bot is not ignoring commit messages that follow the Merge branch 'main' into <some-branch-name> pattern. This is typically the commit message pattern that gets automatically produced when using GitHub's Update Branch button in the UI.

To Reproduce Steps to reproduce the behavior:

  1. Create new branch off of main.
  2. Push any change up on your new branch and open a PR.
  3. Update main with a change.
  4. Select Update Branch on your PR in the GItHub UI (this syncs your working branch with main).
  5. Cocogitto bot should yell about the commit message that gets automatically created.

Expected behavior The bot is expected to ignore the commit message described above.

Additional context The repo does have a cog.toml with the ignore_merge_commits = true configured. I've also attached some screenshots to add further context. The repo is private, so it cannot be linked. Screen Shot 2023-08-07 at 2 42 53 PM Screen Shot 2023-08-07 at 2 42 41 PM

the-wondersmith commented 1 year ago

@oknozor in the spirit of full disclosure @luciidlou and I coworkers and the private repo he's referencing is one of ours.

@luciidlou I 100% spoke incorrectly when I was explaining and said that the default behavior of the bot was to ignore merge commits - that was the default behavior prior to the recently PR that replaced conventional_commit_parser with cocogitto directly. The default cocogitto configuration is to not ignore merge commits and if there is no cog.toml in the target repo, the bot will now use the default for Settings.

@oknozor should I put up another PR to change the bot's config creation to something like:

// Parse the config file into Cocogitto `Settings` (falling
// back to the default if the target repo doesn't have a `cog.toml`)
let cog_config = Settings::try_from(cog_file).unwrap_or_else(|_| Settings {
    ignore_merge_commits: true,
    ..Settings::default()
});

??

the-wondersmith commented 1 year ago

@oknozor Actually... this might be an issue too. That should probably be either the repo-specific "main", the branch the PR is being merged into, or the branch that's being merged from. Not actually sure which without some more thought...

the-wondersmith commented 1 year ago

@oknozor PR is up

I was able to verify proper parsing behavior of committed cog.toml files as well, so I think that should fix the actual code issue(s)? I'm gonna have to lean on your expertise for whether or not anything else might be amiss to cause the observed behavior.

There's no chance it's something like "existing repos need to re-auth the bot to get the updated version" or something, is there?

the-wondersmith commented 1 year ago

@oknozor Bump

the-wondersmith commented 1 year ago

@luciidlou The fix PR for this looks to be merged. Would you be so kind as to verify that it now works as expected?

luciidlou commented 1 year ago

@oknozor Hey there! The PR @the-wondersmith linked above looks like it was merged, but we are still seeing the same issue today (see screenshot). Do we need to remove and re-add cocogitto-bot to any existing repos in order for the changes to take place? Or is there some central deployment that needs updating? Or does the PR that was merged simply just not solve the problem? Screenshot 2023-08-23 at 1 42 19 PM

oknozor commented 1 year ago

Hey, I am not home right now and I don't have access to the cluster where the bot is deployed. I will check the deployment next week.

luciidlou commented 1 year ago

@oknozor bump

the-wondersmith commented 1 year ago

@oknozor bumping again

oknozor commented 1 year ago

Hey, this should be working, can you close/reopen your pull request. I am not able to reproduce this behavior (see: https://github.com/cocogitto/cocogitto_bot_playground/pull/18).

If this is still an issue can you provide a simple reproducer on a public repository ?