Closed stefanzweifel closed 3 years ago
suggest modifying this line to use sh not bash https://github.com/stefanzweifel/git-auto-commit-action/blob/053f35677462851d5d2eec5a9f6f052698c81d92/index.js#L27
Hm, seems it's still broken (?). Will take a closer look throughout the day.
Ok. I think I understand the problem now:
/bin/sh
and /bin/bash
are not the samesh
is a specificationbash
is an implementation of sh
bash
is like sh
but has more features and a better syntax. some commands work differently though.The error happens due do this line:
INPUT_COMMIT_OPTIONS_ARRAY=( $INPUT_COMMIT_OPTIONS );
sh
doesn't support (?) expanding a string into an array by using ( $var )
.
My knowledge for writing scripts so far has been based on bash
and not on sh
. I couldn't figure online out what the real differences between bash
and sh
are.
So porting entrypoint.sh
to sh
proper is quite difficult.
The errors im getting
Started: sh /home/runner/work/_actions/stefanzweifel/git-auto-commit-action/issue-166/entrypoint.sh
/home/runner/work/_actions/stefanzweifel/git-auto-commit-action/issue-166/entrypoint.sh: 78: Syntax error: "(" unexpected (expecting "}")
Error: Invalid status code: 2
at ChildProcess.<anonymous> (/home/runner/work/_actions/stefanzweifel/git-auto-commit-action/issue-166/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: 2
}
bash
is available on all supported platforms of GitHub Actions (Linux, Windows and macOS). sh
is only available on Linux and macOS. As I would like to support all platforms and not just the unix ones, switching to /bin/sh
is counter productive (?).
As I assume that most users are just using the out-of-the-box environment of GitHub Actions and not their own Docker Container/Images I think the effort to update the script to use no bash
is currently not justified. I'm closing this PR for now.
If somebody with better knowledge about the differences between sh
and bash
wants to pick this up: Feel free to submit a new Pull Request.
Update shebang of
entrypoint.sh
to use/bin/sh
instead of/bin/bash
. This change allows users to use the Action in different environments (eg. when they use analpine
-container for a job)Refs #166.