Closed
Description
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
Expectation
Expecting a workflow with updated shellcheck to avoid koalaman/shellcheck#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
Blocks gitpod-io/dockerfreeze#54
Metadata
Metadata
Assignees
Labels
No labels