Skip to content

V6 causes unwanted merge commit #385

@WadeSeidule

Description

@WadeSeidule

git-auto-commit Version

v6

Machine Type

Ubuntu (eg. ubuntu-latest)

Bug description

Image

After updating from v5 -> v6 every time the action auto commits and pushes we get a merge commit followed by the new auto commit like shown in the screenshot. Pinning back to v5 fixes.

The unwanted merge commit can pull in unrelated changes to the current PR.

Steps to reproduce

For me to reproduce is using the action with version v6

Tried solutions

Solved with reverting to v5

Example Workflow

name: Pre-commit Hooks

on:
  pull_request:

permissions:
  contents: write 

jobs:
  pre-commit:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4
        with:
          fetch-depth: 0
          token: ${{ secrets.ORG_GITHUB_TOKEN }}

      - uses: actions/setup-python@v3
        with:
          python-version: 3.9

      - name: Pre-commit first pass (formatting)
        id: pre-commit-1
        run: |-
          pre-commit run --color=always --all-files

      - name: Pre-commit second pass (linting)
        run: |-
          pre-commit run --color=always --all-files

      - name: Check for changes
      shell: bash
      run: |-
        git add .
        git diff --staged --patch --exit-code || echo "self_mutation_happened=true" >> "$GITHUB_OUTPUT"

    - name: Commit mutations
      if: ${{ steps.self_mutation.outputs.self_mutation_happened == 'true' }}
      uses: stefanzweifel/git-auto-commit-action@v6
      with:
        commit_message: automated commit
        skip_fetch: true

    - name: Fail build on mutations
      if: ${{ steps.self_mutation.outputs.self_mutation_happened == 'true' }}
      shell: bash
      run: |-
        echo "files were changed"
        exit 1

Relevant log output

Repository

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions