git-auto-commit-action: nothing to commit, working tree clean Error: Invalid status code: 1

Version of the Action v4.x.x

Describe the bug We seem to be getting this error on every run when there are no change. It only started erroring recently. The file it says is modified is a built javascript file but is probably only whitespace changes hence nothing to commit, we have been using this action for over a year without issue until this point.

Unfortunately this is in a private repo so I am unable to link you and have redacted the repository info below but everything else is verbatim.

Run stefanzweifel/git-auto-commit-action@v4
Started: bash /home/runner/work/_actions/stefanzweifel/git-auto-commit-action/v4/entrypoint.sh
INPUT_REPOSITORY value: .
INPUT_STATUS_OPTIONS: 
INPUT_BRANCH value: 
From https://github.com/xxx/xxx
 * [new branch]      3.23.0         -> origin/3.23.0
 * [new branch]      TA-1911-Cordova-->-Code-Push-->-Ionic/Applow -> origin/TA-1911-Cordova-->-Code-Push-->-Ionic/Applow
 * [new branch]      master         -> origin/master
 * [new tag]         3.22.0         -> 3.22.0
 * [new tag]         3.23.0-beta.0  -> 3.23.0-beta.0
 * [new tag]         3.23.0.alpha.9 -> 3.23.0.alpha.9
M	site/public/vendor/nova-tools/app.js
Your branch is up to date with 'origin/develop'.
INPUT_ADD_OPTIONS: 
INPUT_FILE_PATTERN: .
warning: CRLF will be replaced by LF in site/public/vendor/nova-tools/app.js.
The file will have its original line endings in your working directory
INPUT_COMMIT_OPTIONS: 
INPUT_COMMIT_USER_NAME: GitHub Actions
INPUT_COMMIT_USER_EMAIL: actions@github.com
INPUT_COMMIT_MESSAGE: Publish laravel package assets
INPUT_COMMIT_AUTHOR: dmason30 <dmason30@users.noreply.github.com>
On branch develop
Your branch is up to date with 'origin/develop'.

nothing to commit, working tree clean
Error: Invalid status code: 1
    at ChildProcess.<anonymous> (/home/runner/work/_actions/stefanzweifel/git-auto-commit-action/v4/index.js:[17](https://github.com/TMCApplications/TMC-BACKEND/runs/5316717959?check_suite_focus=true#step:10:17):[19](https://github.com/TMCApplications/TMC-BACKEND/runs/5316717959?check_suite_focus=true#step:10:19))
    at ChildProcess.emit (events.js:[21](https://github.com/xxx/xxx/runs/5316717959?check_suite_focus=true#step:10:21)0:5)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:[28](https://github.com/xxx/xxx/runs/5316717959?check_suite_focus=true#step:10:28)3:5) {
  code: 1
}
Error: Invalid status code: 1
    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)

Used Workflow

name: "Publish assets"

on:
  push:
    branches:
      - develop

jobs:
  publish:

    runs-on: ubuntu-latest

    env:
      TELESCOPE_ENABLED: true

    name: Publish assets

    defaults:
      run:
        working-directory: site

    services:
      mysql:
        image: mysql:8.0
        env:
          MYSQL_ALLOW_EMPTY_PASSWORD: yes
          MYSQL_DATABASE: tmc_test
        ports:
          - 3306
        options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

    steps:
      - name: Checkout code
        uses: actions/checkout@v2
        with:
          ref: ${{ github.head_ref }}

      - name: Cache composer dependencies
        uses: actions/cache@v2
        with:
          path: ~/.composer/cache/files
          key: dependencies-php-8.0-composer-${{ hashFiles('**/composer.lock') }}
          restore-keys: |
            dependencies-php-8.0-composer-

      - name: Setup PHP 8.0
        uses: shivammathur/setup-php@v2
        with:
          php-version: 8.0
          extensions: ctype, curl, date, dom, fileinfo, filter, gd, hash, iconv, intl, json, libxml, mbstring, openssl, pcntl, pcre, pdo, pdo_sqlite, pdo_mysql, phar, posix, simplexml, spl, sqlite, tokenizer, tidy, xml, xmlreader, xmlwriter, zip, zlib
          coverage: none

      - name: Reset MySQL root user authentication method
        run: mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports[3306] }} -uroot -e "alter user 'root'@'%' identified with mysql_native_password by ''"

      - name: Prepare Laravel Application
        run: cp .env.testing .env

      - name: Install PHP dependencies (composer)
        run: |
          composer config "http-basic.nova.laravel.com" "${{ secrets.NOVA_USERNAME }}" "${{ secrets.NOVA_PASSWORD }}"
          composer install --no-interaction

      - name: Run migration and publish
        run: |
          php artisan migrate --force
          composer publish
        env:
          DB_HOST: 127.0.0.1
          DB_PORT: ${{ job.services.mysql.ports[3306] }}

      - uses: stefanzweifel/git-auto-commit-action@v4
        with:
          commit_message: Publish laravel package assets

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 15 (7 by maintainers)

Commits related to this issue

Most upvoted comments

@stefanzweifel

But you seem to have a very unique workflow that just doesn’t fit into this Action.

That’s ok, like I said, it’s probably out of your scope. I’d like to move away from this workflow in the long term anyway. Thanks for your time!

@stefanzweifel Yeah I know it’s probably not the cleanest approach, but it does work. Alternative would be to leave compiled assets out completely, and compile them while deploying, but that’s not an option for now unfortunately. The merge conflicts did get very annoying.

Without add_options: '-f' and skip_dirty_check : true this workflow does not work. Without those options git will not pick up changes in the compiled assets, because they are in .gitignore…

But thanks for pointing me in the right direction (feel kinda stupid that I missed this myself), it does work when adding the --allow-empty commit option!

@Grldk Maybe a silly question, but why are you adding these files to .gitignore just to then force add them in CI? Did you run into so many merge conflicts before? Does this reliably work on your local machine? Did you try this workflow without setting add_options: '-f' and skip_dirty_check : true?

My gut tells me, that this might be related to the findings from here: https://github.com/stefanzweifel/git-auto-commit-action/issues/227#issuecomment-1169075106

The Action breaks on this line when creating the commit: https://github.com/stefanzweifel/git-auto-commit-action/blob/dce7e85096193516db2ae686bd562faf5bc7f4ea/entrypoint.sh#L95-L98. Maybe you would also have to add a commit option to make this work?

Hey @emepetres, the Action currently doesn’t support to be run on windows-latest unfortunately:

Note that the Action has to be used in a Job that runs on a UNIX system (eg. ubuntu-latest). If you don’t use the default permission of the GITHUB_TOKEN, give the Job or Workflow at least the contents: write permission.

As mentioned in this comment, I haven’t touched a Windows machine in years. This makes debugging hard. I see you’re a .NET-shop and therefore rely on Windows … so this is a bummer of course.

Another user mentioned that he even has issues running the Action on Ubuntu (https://github.com/stefanzweifel/git-auto-commit-action/issues/177#issuecomment-1018275327) which I can’t reproduce.

If you have any insights that could make this Action compatible with Windows let me now! Will try to install a Windows VM on my machine in the next few weeks. Maybe I can find a solution.

I ran the above workflow but changing to use v3 of your action instead and I do not encounter the above error.

Run stefanzweifel/git-auto-commit-action@v3
/usr/bin/docker run --name db2d73ba30ecc82754bdbb2609ffb28a7fd[15](https://github.com/xxx/xxx/runs/5321542307?check_suite_focus=true#step:11:15)_f77e40 --label 7db2d7 --workdir /github/workspace --rm -e TELESCOPE_ENABLED -e COMPOSER_PROCESS_TIMEOUT -e COMPOSER_NO_INTERACTION -e INPUT_COMMIT_MESSAGE -e INPUT_BRANCH -e INPUT_COMMIT_OPTIONS -e INPUT_FILE_PATTERN -e INPUT_REPOSITORY -e INPUT_COMMIT_USER_NAME -e INPUT_COMMIT_USER_EMAIL -e INPUT_COMMIT_AUTHOR -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_RUN_ATTEMPT -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_REF_NAME -e GITHUB_REF_PROTECTED -e GITHUB_REF_TYPE -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_ARCH -e RUNNER_NAME -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true --network github_network_2302029a948e46faa76[18](https://github.com/xxx/xxxx/runs/5321542307?check_suite_focus=true#step:11:18)2d4bbdc7b79 -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/xxx/xxx":"/github/workspace" 7db2d7:3ba30ecc82754bdbb2609ffb28a7fd15
INPUT_REPOSITORY value: .
INPUT_BRANCH value: 
M	site/public/vendor/nova-tools/app.js
Your branch is up to date with 'origin/develop'.
INPUT_FILE_PATTERN: .
warning: CRLF will be replaced by LF in site/public/vendor/nova-tools/app.js.
The file will have its original line endings in your working directory
INPUT_COMMIT_OPTIONS: 
On branch develop
Your branch is up to date with 'origin/develop'.

nothing to commit, working tree clean

I then ran on 4.0.0 and the error occurs as described in the original post so I guess its some difference between the docker and node environments.

I will just stick with v4 and add continue-on-error: true for now to the step and keep an eye on it to make sure it does commit when there are changes.