Enable Shellcheck on changed files (#4431)
* Enable Shellcheck on changed files On DIFF between PR and master * Small improvement
This commit is contained in:
parent
5cdd5cdd59
commit
1464a7b4c3
21
.github/workflows/lint-scripts-pr.yml
vendored
21
.github/workflows/lint-scripts-pr.yml
vendored
@ -6,7 +6,7 @@ name: Lint On Scripts
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
types: [review_requested, ready_for_review]
|
||||
types: [review_requested, ready_for_review, opened, reopened, edited, synchronize]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
@ -26,18 +26,13 @@ jobs:
|
||||
- name: Environment variables
|
||||
run: sudo -E bash -c set
|
||||
|
||||
- name: "Shellcheck lint error report in diff format"
|
||||
- name: "Shellcheck on changed files"
|
||||
shell: bash {0}
|
||||
run: |
|
||||
|
||||
(for file in $(find lib -type f -exec grep -Iq . {} \; -print); do shellcheck --format=diff $file; done;) 2> /dev/null > lib.diff || true
|
||||
(for file in $(find packages -type f -exec grep -Iq . {} \; -print); do shellcheck --format=diff $file; done;) 2> /dev/null > packages.diff || true
|
||||
(for file in $(find config -type f -exec grep -Iq . {} \; -print); do shellcheck --format=diff $file; done;) 2> /dev/null > config.diff || true
|
||||
|
||||
- name: Upload build artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: Shellcheck
|
||||
path: "*.diff"
|
||||
if-no-files-found: ignore
|
||||
retention-days: 14
|
||||
for file in $(git diff --name-only master..HEAD); do
|
||||
# We are only interested in BASH scripts
|
||||
if grep -qE "#\!/" $file; then
|
||||
shellcheck $file
|
||||
fi
|
||||
done
|
||||
|
||||
Loading…
Reference in New Issue
Block a user