Skip to content

fail gh action if pipeline failed in .github/workflows/pipeline_test.yaml #7

fail gh action if pipeline failed in .github/workflows/pipeline_test.yaml

fail gh action if pipeline failed in .github/workflows/pipeline_test.yaml #7

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