Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

abort in initscripts shfmt check when no git repo #37

Open
azrdev opened this issue Jun 19, 2024 · 0 comments
Open

abort in initscripts shfmt check when no git repo #37

azrdev opened this issue Jun 19, 2024 · 0 comments

Comments

@azrdev
Copy link

azrdev commented Jun 19, 2024

My CI runs abort due to git diff returning 128 (and printing its --help message) from the two invocations in https://github.com/openwrt/gh-action-sdk/blob/9c3ea37/entrypoint.sh#L141
GH action output:

[...]
  time: package/feeds/action/snapcast/check#0.01#0.00#0.02
  make[1]: Leaving directory '/builder'
find: ‘shfmt’: No such file or directory
find: ‘shfmt’: No such file or directory
warning: Not a git repository. Use --no-index to compare two paths outside a working tree
usage: git diff --no-index [<options>] <path> <path>
[...]
fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
init script must be formatted. Please run through shfmt -w -sr -s
Error: Process completed with exit code 128.
Run sudo chown -R --reference=/home/runner/work/snapos/snapos/.. /home/runner/work/snapos/snapos

code at https://github.com/azrdev/snapos/tree/4dedda34e9e23f8134fe30ef8879d220f725a315

I think what happens is that the package download fetches a tarball from github instead of a git clone / local checkout, and thus git -C .../files diff cannot find a .git dir -- and exits.

To fix, maybe there already is a marker telling if the code was checked out from a repo, and only enable the checks relying on git diff if that's true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant