Skip to content

With "branch: master" raises "error: pathspec 'master' did not match any file(s) known to git" #141

@pablosjv

Description

@pablosjv

Version of the Action
v4.8.0

Describe the bug

Setting the parameter branch: maser gives the following error:

Started: bash /home/runner/work/_actions/stefanzweifel/git-auto-commit-action/v4.8.0/entrypoint.sh
INPUT_REPOSITORY value: .
INPUT_BRANCH value: master
error: pathspec 'master' did not match any file(s) known to git
Error: Invalid status code: 1
    at ChildProcess.<anonymous> (/home/runner/work/_actions/stefanzweifel/git-auto-commit-action/v4.8.0/index.js:17:19)
    at ChildProcess.emit (events.js:210:5)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5) {
  code: 1
}
Error: Invalid status code: 1
    at ChildProcess.<anonymous> (/home/runner/work/_actions/stefanzweifel/git-auto-commit-action/v4.8.0/index.js:17:19)
    at ChildProcess.emit (events.js:210:5)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)

To Reproduce

To reproduce, setup the following workflow and run it. When the branch: master parameter is removed, the workflow works as expected.

Used Workflow

name: refresh

on:
  push:
    branches: [master]

  workflow_dispatch:

jobs:
  refresh:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
        with:
          ref: ${{ github.head_ref }}
          submodules: "recursive"

      - name: Install python and dependencies
        uses: actions/setup-python@v2
        with:
          python-version: "3.9" 

      # NOTE: here I have a script that creates new files. I simplify it for debugging.
      - name: Create a dummy file 
        run: touch dummy-$(date '+%Y%m%d%H%M%S').txt

      - name: Git Auto Commit
        uses: stefanzweifel/git-auto-commit-action@v4.8.0
        with:
          commit_message: "chore: refresh files"
          branch: master

Additional context

This problem seems to be related with the issue #6

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