forked from kubeflow/manifests
-
Notifications
You must be signed in to change notification settings - Fork 0
40 lines (30 loc) · 1.13 KB
/
bash_formatter.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
name: Proper Formatting on bash files
on: [push, pull_request]
jobs:
format_bash_files:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install ShellCheck
run: sudo apt install -y shellcheck
- name: Bash Formatting Guidelines
run: |
echo "### Bash Files Formatting Guidelines ###
If there are errors and warnings regarding your bash files,
You can check that error code definitions in https://www.shellcheck.net/wiki/ site.
You can correct them using the https://www.shellcheck.net/ site.
You have to ignore disable errors in .shellcheckrc file.
"
- name: Fetch master branch
run: git fetch origin master
- name: Set up changed files
run: |
git diff --name-only origin/master...HEAD | grep -E '^.*\.sh$' | grep -v '^apps/' > changed_files_in_PR.txt || true
- name: Display changed files
run: cat changed_files_in_PR.txt
- name: Run ShellCheck on changed files
run: |
cat changed_files_in_PR.txt | xargs -I {} shellcheck {}
shell: bash