2024-12-26 18:00:33 +00:00
|
|
|
name: Shellcheck
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
pull_request:
|
|
|
|
workflow_dispatch:
|
|
|
|
schedule:
|
|
|
|
- cron: "5 1 * * *"
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
shellcheck:
|
|
|
|
name: Shellcheck
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
|
2025-01-01 12:13:19 +00:00
|
|
|
- name: Get changed files
|
2025-01-13 12:02:42 +00:00
|
|
|
id: changed-files
|
|
|
|
uses: tj-actions/changed-files@v45
|
|
|
|
with:
|
|
|
|
files: |
|
|
|
|
**.sh
|
|
|
|
|
2025-01-14 13:37:26 +00:00
|
|
|
- name: Download ShellCheck
|
2025-01-13 12:02:42 +00:00
|
|
|
shell: bash
|
|
|
|
env:
|
|
|
|
INPUT_VERSION: "v0.10.0"
|
2025-01-01 12:13:19 +00:00
|
|
|
run: |
|
2025-01-14 13:33:32 +00:00
|
|
|
set -euo pipefail
|
2025-01-13 12:02:42 +00:00
|
|
|
if [[ "${{ runner.os }}" == "macOS" ]]; then
|
|
|
|
osvariant="darwin"
|
2025-01-01 17:26:23 +00:00
|
|
|
else
|
2025-01-13 12:02:42 +00:00
|
|
|
osvariant="linux"
|
2025-01-01 17:26:23 +00:00
|
|
|
fi
|
2025-01-14 13:37:26 +00:00
|
|
|
|
2025-01-13 12:02:42 +00:00
|
|
|
baseurl="https://github.com/koalaman/shellcheck/releases/download"
|
2025-01-14 13:35:51 +00:00
|
|
|
curl -Lso "${{ github.workspace }}/sc.tar.xz" \
|
2025-01-13 12:02:42 +00:00
|
|
|
"${baseurl}/${INPUT_VERSION}/shellcheck-${INPUT_VERSION}.${osvariant}.x86_64.tar.xz"
|
2025-01-14 13:37:26 +00:00
|
|
|
|
2025-01-14 13:35:51 +00:00
|
|
|
tar -xf "${{ github.workspace }}/sc.tar.xz" -C "${{ github.workspace }}"
|
|
|
|
mv "${{ github.workspace }}/shellcheck-${INPUT_VERSION}/shellcheck" \
|
|
|
|
"${{ github.workspace }}/shellcheck"
|
|
|
|
|
2025-01-14 13:37:26 +00:00
|
|
|
- name: Verify ShellCheck binary
|
|
|
|
run: |
|
|
|
|
ls -l "${{ github.workspace }}/shellcheck"
|
2025-01-13 12:02:42 +00:00
|
|
|
|
2025-01-14 13:37:26 +00:00
|
|
|
- name: Display ShellCheck version
|
2025-01-13 12:02:42 +00:00
|
|
|
run: |
|
2025-01-14 13:37:26 +00:00
|
|
|
"${{ github.workspace }}/shellcheck" --version
|
2025-01-13 12:02:42 +00:00
|
|
|
|
2024-12-26 18:00:33 +00:00
|
|
|
- name: Run ShellCheck
|
2025-01-14 13:37:26 +00:00
|
|
|
if: steps.changed-files.outputs.any_changed == 'true'
|
2025-01-13 12:02:42 +00:00
|
|
|
env:
|
|
|
|
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
|
2025-01-01 12:13:19 +00:00
|
|
|
run: |
|
2025-01-14 13:37:26 +00:00
|
|
|
echo "${ALL_CHANGED_FILES}" | xargs "${{ github.workspace }}/shellcheck"
|