stefanzweifel / git-auto-commit-action

Automatically commit and push changed files back to GitHub with this GitHub Action for the 80% use case.
MIT License
1.96k stars 226 forks source link

Not able to commit #198

Closed guiyep closed 2 years ago

guiyep commented 2 years ago

While running the girhub action on release I get the next error:

 Author: guiyep <guiyep@gmail.com>
 1 file changed, 1 insertion(+), 1 deletion(-)
INPUT_TAGGING_MESSAGE: 
No tagging message supplied. No tag will be added.
INPUT_PUSH_OPTIONS: 
fatal: You are not currently on a branch.
To push the history leading to the current (detached HEAD)
state now, use

    git push origin HEAD:<name-of-remote-branch>

Error: Invalid status code: 128
    at ChildProcess.<anonymous> (/home/runner/work/_actions/stefanzweifel/git-auto-commit-action/v4/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: 128
}
Error: Invalid status code: 128
    at ChildProcess.<anonymous> (/home/runner/work/_actions/stefanzweifel/git-auto-commit-action/v4/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)

Actions:


on:
  release:
    types: [published]

jobs:
  library:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - uses: actions/setup-node@v2
        with:
          node-version: '14.x'
          registry-url: 'https://registry.npmjs.org'

      - run: yarn

      - run: yarn build-prod

      - run: npm publish --access public
        env:
          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

      - run: yarn bundle-size

      - uses: stefanzweifel/git-auto-commit-action@v4
        with:
          commit_message: "[CI] publish new bundle size"
          commit_user_name: Guillermo Polit
          commit_user_email: guiyep@gmail.com
          commit_author: guiyep <guiyep@gmail.com>

Any idea? What it is only failing is the stefanzweifel/git-auto-commit-action@v4 section

stefanzweifel commented 2 years ago

Thanks for reporting. For now, I've reset v4 to alias to v4.12.0. Will have to investigate this further.

stefanzweifel commented 2 years ago

fatal: You are not currently on a branch. To push the history leading to the current (detached HEAD) state now, use

This is the problem. You have to checkout a branch in the actions/checkout step. (On the release trigger, GitHub Actions doesn't know which branch to checkout)

Add ref: main to the checkout step. (See docs https://github.com/actions/checkout)

guiyep commented 2 years ago

I wonder what is publishing my action then :) let me try! there may be something between master and main here

guiyep commented 2 years ago

It is defaulting to master already.

Using 'master' as the name for the initial branch.
stefanzweifel commented 2 years ago

@guiyep Hm. Could you add branch to the auto-commit-action-step?

      - uses: stefanzweifel/git-auto-commit-action@v4
        with:
+         branch: master
          commit_message: "[CI] publish new bundle size"
          commit_user_name: Guillermo Polit
          commit_user_email: guiyep@gmail.com
          commit_author: guiyep <guiyep@gmail.com>
guiyep commented 2 years ago

let me give a try! thanks for the help :)

guiyep commented 2 years ago

worked! thanks for the help :)