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
- fix: failing push when no changes to build files See https://github.com/stefanzweifel/git-auto-commit-action/issues/204 — committed to alixlahuec/zotero-roam by alixlahuec 4 years ago
- Assert throws error when force adding ignored files See https://github.com/stefanzweifel/git-auto-commit-action/issues/204#issuecomment-1236880360 — committed to stefanzweifel/git-auto-commit-action by stefanzweifel 4 years ago
- Squashed commit of the following: commit fe1c228e1302ce65e5640a26a511c1408fa5e0be Author: Constantin Comendant <constantin@uberagent.com> Date: Thu Apr 11 14:53:29 2024 +0200 remove changelog ... — committed to vastlimits/uberAgent-config by deleted user 3 years ago
@stefanzweifel
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'andskip_dirty_check : truethis 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-emptycommit option!@Grldk Maybe a silly question, but why are you adding these files to
.gitignorejust 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 settingadd_options: '-f'andskip_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-latestunfortunately: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
v3of your action instead and I do not encounter the above error.I then ran on
4.0.0and 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: truefor now to the step and keep an eye on it to make sure it does commit when there are changes.