Skip to content

Commit 76a8817

Browse files
owineclaude
andcommitted
fix: move shellcheck to compose-workflow validation workflow
Move shellcheck validation from reusable lint.yml to yamllint.yml: Changes: - Remove shellcheck job from lint.yml (reusable workflow) - Removed shellcheck job definition - Removed from needs arrays in lint-summary and notify jobs - Removed from lint-summary validation logic - Removed from Discord notification description - Removed shellcheck failure section from notifications - Add shellcheck job to yamllint.yml (compose-workflow validation) - New shellcheck job runs on push, PR, and manual dispatch - Validates all scripts in scripts/deployment/ - Reports pass/fail status with actionable error messages - Runs in parallel with yamllint and actionlint Rationale: The reusable lint.yml workflow is called by other repositories (docker-piwine, docker-zendc, etc.) to validate their Docker Compose files. ShellCheck should validate the compose-workflow repository's deployment scripts, not the calling repositories. yamllint.yml is the correct location as it validates the compose-workflow repository itself (workflows, deployment scripts). ✅ Both workflows pass actionlint validation ✅ All deployment scripts pass shellcheck 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent fe4750c commit 76a8817

File tree

2 files changed

+51
-96
lines changed

2 files changed

+51
-96
lines changed

.github/workflows/lint.yml

Lines changed: 3 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -154,70 +154,6 @@ jobs:
154154
- name: Run actionlint
155155
uses: raven-actions/actionlint@963d4779ef039e217e5d0e6fd73ce9ab7764e493 # v2.1.0
156156

157-
shellcheck:
158-
name: Shell script validation
159-
runs-on: ubuntu-24.04
160-
timeout-minutes: 5
161-
steps:
162-
- name: Checkout compose-workflow repository
163-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
164-
with:
165-
repository: owine/compose-workflow
166-
ref: main
167-
168-
- name: Display version information
169-
run: |
170-
echo "📋 ShellCheck Validation"
171-
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
172-
echo "Repository: compose-workflow (deployment scripts)"
173-
echo "Runner: ${{ runner.os }} ${{ runner.arch }}"
174-
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
175-
176-
- name: Run shellcheck on deployment scripts
177-
run: |
178-
echo "🐚 Starting ShellCheck validation for deployment scripts..."
179-
echo ""
180-
181-
# Find and validate all shell scripts
182-
SCRIPTS=$(find scripts/deployment -name "*.sh" -type f | sort)
183-
184-
if [ -z "$SCRIPTS" ]; then
185-
echo "⚠️ No shell scripts found in scripts/deployment/"
186-
exit 0
187-
fi
188-
189-
echo "📁 Scripts to validate:"
190-
# shellcheck disable=SC2001
191-
echo "$SCRIPTS" | sed 's/^/ • /'
192-
echo ""
193-
194-
# Run shellcheck on all scripts
195-
FAILED=0
196-
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
197-
198-
for script in $SCRIPTS; do
199-
echo "🔍 Checking: $script"
200-
if shellcheck "$script"; then
201-
echo " ✅ PASSED"
202-
else
203-
echo " ❌ FAILED"
204-
FAILED=1
205-
fi
206-
echo ""
207-
done
208-
209-
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
210-
211-
if [ $FAILED -eq 0 ]; then
212-
echo "🎉 ALL SHELL SCRIPTS PASSED VALIDATION"
213-
echo " All deployment scripts follow best practices"
214-
else
215-
echo "💥 SHELL SCRIPT VALIDATION FAILED"
216-
echo " Fix the issues shown above"
217-
echo " Run locally: shellcheck scripts/deployment/**/*.sh"
218-
exit 1
219-
fi
220-
221157
lint:
222158
strategy:
223159
matrix:
@@ -422,7 +358,7 @@ jobs:
422358
lint-summary:
423359
name: Lint Summary
424360
runs-on: ubuntu-24.04
425-
needs: [scanning, actionlint, shellcheck, lint]
361+
needs: [scanning, actionlint, lint]
426362
if: always()
427363
timeout-minutes: 5
428364
steps:
@@ -527,26 +463,6 @@ jobs:
527463
528464
echo ""
529465
530-
# ShellCheck Shell Script Validation Results
531-
echo "🐚 SHELL SCRIPT VALIDATION (SHELLCHECK)"
532-
echo "───────────────────────────────────────────────────────────────────────────────────"
533-
case "${{ needs.shellcheck.result }}" in
534-
"success")
535-
echo "✅ PASSED - All deployment scripts follow best practices"
536-
SHELLCHECK_OK=true
537-
;;
538-
"failure")
539-
echo "❌ FAILED - Shell script issues detected"
540-
SHELLCHECK_OK=false
541-
;;
542-
*)
543-
echo "❓ UNKNOWN - Unexpected shellcheck result: ${{ needs.shellcheck.result }}"
544-
SHELLCHECK_OK=false
545-
;;
546-
esac
547-
548-
echo ""
549-
550466
# Detailed Lint Results with Error Reproduction
551467
echo "📋 CODE QUALITY VALIDATION - DETAILED RESULTS"
552468
echo "───────────────────────────────────────────────────────────────────────────────────"
@@ -664,7 +580,7 @@ jobs:
664580
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
665581
666582
# Final determination
667-
if [[ "$SCANNING_OK" == "true" && "$ACTIONLINT_OK" == "true" && "$SHELLCHECK_OK" == "true" && "$LINT_OK" == "true" ]]; then
583+
if [[ "$SCANNING_OK" == "true" && "$ACTIONLINT_OK" == "true" && "$LINT_OK" == "true" ]]; then
668584
echo "🎉 FINAL STATUS: ALL VALIDATION CHECKS PASSED"
669585
echo " Repository is ready for deployment"
670586
exit 0
@@ -675,7 +591,6 @@ jobs:
675591
echo " Failed components:"
676592
[[ "$SCANNING_OK" != "true" ]] && echo " • GitGuardian security scanning"
677593
[[ "$ACTIONLINT_OK" != "true" ]] && echo " • Workflow validation (actionlint)"
678-
[[ "$SHELLCHECK_OK" != "true" ]] && echo " • Shell script validation (shellcheck)"
679594
[[ "$LINT_OK" != "true" ]] && echo " • Code quality validation (see detailed errors above)"
680595
echo ""
681596
exit 1
@@ -684,7 +599,7 @@ jobs:
684599
notify:
685600
name: Discord Notification
686601
runs-on: ubuntu-24.04
687-
needs: [scanning, actionlint, shellcheck, lint, lint-summary]
602+
needs: [scanning, actionlint, lint, lint-summary]
688603
if: always()
689604
steps:
690605
- name: Configure 1Password Service Account
@@ -713,7 +628,6 @@ jobs:
713628
714629
**🔒 Security Scan:** ${{ needs.scanning.result == 'success' && '✅ No secrets detected' || needs.scanning.result == 'skipped' && '⏭️ Skipped (PR/manual)' || '❌ Issues found' }}
715630
**⚙️ Workflow Validation:** ${{ needs.actionlint.result == 'success' && '✅ All workflows valid' || '❌ Issues detected' }}
716-
**🐚 Shell Scripts:** ${{ needs.shellcheck.result == 'success' && '✅ Best practices followed' || '❌ Issues detected' }}
717631
**📋 Code Quality:** ${{ needs.lint.result == 'success' && '✅ All stacks valid' || '❌ Issues detected' }}
718632
719633
**📂 Validated Stacks:** `${{ join(fromJson(inputs.stacks), '`, `') }}`
@@ -727,13 +641,6 @@ jobs:
727641
• Fix workflow syntax, shellcheck, or expression errors
728642
• Test locally: `actionlint .github/workflows/*.yml`' || '' }}
729643
730-
${{ needs.shellcheck.result == 'failure' && '
731-
**🐚 Shell Script Issues:**
732-
• Shell script best practices violations detected
733-
• Review the **Shell Script Validation** job for details
734-
• Fix quoting, variable usage, or syntax issues
735-
• Test locally: `shellcheck scripts/deployment/**/*.sh`' || '' }}
736-
737644
${{ needs.lint.result == 'failure' && '
738645
**🚨 Action Required:**
739646
• Review stack validation errors in workflow logs

.github/workflows/yamllint.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,51 @@ jobs:
4040

4141
- name: Run actionlint
4242
uses: raven-actions/actionlint@963d4779ef039e217e5d0e6fd73ce9ab7764e493 # v2.1.0
43+
44+
shellcheck:
45+
runs-on: ubuntu-24.04
46+
timeout-minutes: 5
47+
steps:
48+
- name: Checkout repository
49+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
50+
51+
- name: Run shellcheck on deployment scripts
52+
id: shellcheck
53+
continue-on-error: true
54+
run: |
55+
echo "🐚 Validating shell scripts..."
56+
57+
# Find all shell scripts in scripts/deployment
58+
SCRIPTS=$(find scripts/deployment -name "*.sh" -type f | sort)
59+
60+
if [ -z "$SCRIPTS" ]; then
61+
echo "⚠️ No shell scripts found in scripts/deployment/"
62+
exit 0
63+
fi
64+
65+
echo "📁 Found $(echo "$SCRIPTS" | wc -l) shell script(s):"
66+
# shellcheck disable=SC2001
67+
echo "$SCRIPTS" | sed 's/^/ • /'
68+
echo ""
69+
70+
# Run shellcheck on all scripts
71+
FAILED=0
72+
for script in $SCRIPTS; do
73+
if ! shellcheck "$script"; then
74+
FAILED=1
75+
fi
76+
done
77+
78+
exit $FAILED
79+
80+
- name: Report results
81+
if: always()
82+
run: |
83+
if [ "${{ steps.shellcheck.outcome }}" = "success" ]; then
84+
echo "✅ All shell scripts follow best practices"
85+
else
86+
echo "❌ Shell script issues found"
87+
echo "Please fix the issues above"
88+
echo "Test locally: shellcheck scripts/deployment/**/*.sh"
89+
exit 1
90+
fi

0 commit comments

Comments
 (0)