Seems that using github action with a container results in .git being stripped
drwxr-xr-x 5 1001 115 4096 Mar 4 21:34 .
drwxr-xr-x 3 1001 115 4096 Mar 4 21:34 ..
drwxrwxr-x 3 root root 4096 Mar 4 21:34 .github
-rw-rw-r-- 1 root root 347 Mar 4 21:34 .gitignore
-rw-rw-r-- 1 root root 427 Mar 4 21:34 .gitpod.yml
-rw-rw-r-- 1 root root 3346 Mar 4 21:34 CODE_OF_CONDUCT.md
-rw-rw-r-- 1 root root 209 Mar 4 21:34 Cargo.toml
-rw-rw-r-- 1 root root 1077 Mar 4 21:34 LICENSE
-rw-rw-r-- 1 root root 328 Mar 4 21:34 README.md
-rw-rw-r-- 1 root root 182 Mar 4 21:34 build.rs
drwxrwxr-x 2 root root 4096 Mar 4 21:34 src
drwxrwxr-x 2 root root 4096 Mar 4 21:34 tools
fatal: not a git repository: '/__w/dockerfreeze/dockerfreeze/.git'
##[error]Process completed with exit code 128.
See: https://github.com/Kreyren/dockerfreeze/pull/1/checks?check_run_id=486094327
Expecting a workflow with updated shellcheck to avoid https://github.com/koalaman/shellcheck/issues/1771 due to the old version of linting tool used on default image and process only changed files in the merge request if they are supported by specified linting tool.
name: Bash
# Relevant to events - https://help.github.com/en/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows
on:
pull_request:
types: [synchronize, opened, reopened, ready_for_review]
paths:
- '**.bash'
- "tools/dockerfreeze"
jobs:
# Linting
lint:
runs-on: ubuntu-latest
container: debian:latest
steps:
- uses: actions/checkout@v2
- name: Installing dependencies..
run: |
# Sync repos
apt update
# Install git
apt install -y git
if ! apt list --installed 2>/dev/null | grep -q "git.*"; then
apt install -y git
elif apt list --installed 2>/dev/null | grep -q "git.*"; then
true
else
exit 255
fi
# Install shellcheck
if ! apt list --installed 2>/dev/null | grep -q ".*shellcheck.*"; then
apt install -y shellcheck
elif apt list --installed 2>/dev/null | grep -q ".*shellcheck.*"; then
true
else
exit 255
fi
- name: Linting..
shell: bash
run: |
cd "$GITHUB_WORKSPACE"
ls -la
# Process files
## NOTICE: Do not use for loop to avoid pitfall https://mywiki.wooledge.org/BashPitfalls#pf1
git --git-dir="$GITHUB_WORKSPACE/.git" ls-files -z -- '*.bash' tools/dockerfreeze | while IFS= read -rd '' file; do
printf 'linting bash file %s' "$file"
shellcheck --external-sources --shell=bash "$file"
done
When Git 2.18 or higher isnt in the PATH, the repo is downloaded using the REST API
@ericsciple it is in PATH

you might need to move that step before the checkout step
@ericsciple Same issue with it being moved, see https://github.com/gitpod-io/dockerfreeze/pull/54/checks?check_run_id=486990582

EDIT: i am editing wrong branch, checking
Solved by using @ericsciple suggestion
Thanks!
We had the same problem. Maybe it makes sense to add some kind of troubleshoot section in readme?
Or even an api: true option (defaulting false) - seems like quite a gotcha, for not _much_ benefit.
(Since a hard fail 'git not found' would help people understand the problem much quicker, I mean)
Most helpful comment
you might need to move that step before the checkout step