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.98k stars 227 forks source link

Unable to push on branch #151

Closed xenoterracide closed 3 years ago

xenoterracide commented 3 years ago

given this build configuration

name: PlantUML
on:
  push:
    paths:
      - '**.puml'
jobs:
  plantuml:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
        with:
          ref: ${{ github.head_ref }}
      - name: Get changed UML files
        id: getfile
        run: |
          echo "::set-output name=files::$(git diff-tree -r --no-commit-id --name-only ${{ github.sha }} | grep '.puml' | xargs)"
      - name: UML files considered echo output
        run: |
          echo ${{ steps.getfile.outputs.files }}
      - name: Generate SVG Diagrams
        uses: cloudbees/plantuml-github-action@master
        with:
          args: -v -tsvg ${{ steps.getfile.outputs.files }}
      - uses: stefanzweifel/git-auto-commit-action@v4.9.2
        with:
          commit_message: 'Generate SVG images for PlantUML diagrams'
          file_pattern: '*.svg'

I'm getting this error

INPUT_COMMIT_USER_NAME: GitHub Actions
INPUT_COMMIT_USER_EMAIL: actions@github.com
INPUT_COMMIT_MESSAGE: Generate SVG images for PlantUML diagrams
INPUT_COMMIT_AUTHOR: xenoterracide <xenoterracide@users.noreply.github.com>
[detached HEAD 6c13160] Generate SVG images for PlantUML diagrams
 Author: xenoterracide <xenoterracide@users.noreply.github.com>
 1 file changed, 40 insertions(+)
 create mode 100644 user.svg
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.9.2/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.9.2/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)

this is probably a documentation issue, but I don't see anything more about fixing it in the documentation

stefanzweifel commented 3 years ago

Same answer as in #152:

I see you're using v1 of actions/checkout. Could you upgrade to v2? The latest version of git-auto-commit requires you to use at least actions/checkout@v2: https://github.com/stefanzweifel/git-auto-commit-action#checkout-the-correct-branch

xenoterracide commented 3 years ago

yeah, it worked, though it was a pain getting the rest of the code that involved git working again.