@hybridlabor-api/aos 4.8.0 → 4.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/agents.md +1 -1
- package/.agents/nodes.json +1 -1
- package/.agents/vendor-manifest.json +23 -1
- package/.claude/agents/godmode-media-eventtech.md +1 -1
- package/.claude/hooks/conventional-commits.mjs +125 -0
- package/.claude/hooks/env-file-protection.mjs +105 -0
- package/.claude/hooks/go-gate.mjs +101 -81
- package/.claude/settings.json +13 -0
- package/.opencode/agents/godmode-media-eventtech.md +1 -1
- package/.opencode/plugins/bdb-aos.js +31 -4
- package/README.de.md +1 -1
- package/README.md +1 -1
- package/README.pt.md +1 -1
- package/THIRD_PARTY_NOTICES.md +88 -0
- package/docs/skills_table.md +1 -1
- package/installer.js +174 -46
- package/package.json +6 -2
- package/packages/aos-cli/README.md +80 -0
- package/packages/aos-cli/bin/aos-cli.mjs +134 -0
- package/packages/aos-cli/core-skills.json +12 -0
- package/packages/aos-cli/extensions/aos.ts +321 -0
- package/packages/aos-cli/package-lock.json +1923 -0
- package/packages/aos-cli/package.json +29 -0
- package/packages/aos-cli/scripts/check-theme.mjs +63 -0
- package/packages/aos-cli/themes/aos.json +97 -0
- package/scripts/build-plugin-manifest.mjs +131 -0
- package/scripts/validate-skills.mjs +81 -6
- package/skills/basic/ao-orchestrator/SKILL.md +116 -0
- package/skills/global_config/agenttrail/SKILL.md +6 -1
- package/skills/global_config/ask-tim/SKILL.md +4 -4
- package/skills/global_config/bash-script-generator/SKILL.md +201 -0
- package/skills/global_config/bash-script-generator/assets/templates/standard-template.sh +96 -0
- package/skills/global_config/bash-script-generator/docs/bash-scripting-guide.md +729 -0
- package/skills/global_config/bash-script-generator/docs/generation-best-practices.md +193 -0
- package/skills/global_config/bash-script-generator/docs/script-patterns.md +566 -0
- package/skills/global_config/bash-script-generator/docs/text-processing-guide.md +437 -0
- package/skills/global_config/bash-script-generator/examples/log-analyzer.sh +92 -0
- package/skills/global_config/bash-script-generator/scripts/generate_script_template.sh +123 -0
- package/skills/global_config/bash-script-generator/scripts/run_ci_checks.sh +172 -0
- package/skills/global_config/bash-script-generator/scripts/test_generator.sh +413 -0
- package/skills/global_config/bash-script-validator/SKILL.md +249 -0
- package/skills/global_config/bash-script-validator/docs/awk-reference.md +449 -0
- package/skills/global_config/bash-script-validator/docs/bash-reference.md +468 -0
- package/skills/global_config/bash-script-validator/docs/common-mistakes.md +623 -0
- package/skills/global_config/bash-script-validator/docs/grep-reference.md +395 -0
- package/skills/global_config/bash-script-validator/docs/regex-reference.md +391 -0
- package/skills/global_config/bash-script-validator/docs/sed-reference.md +454 -0
- package/skills/global_config/bash-script-validator/docs/shell-reference.md +463 -0
- package/skills/global_config/bash-script-validator/docs/shellcheck-reference.md +399 -0
- package/skills/global_config/bash-script-validator/examples/bad-bash.sh +55 -0
- package/skills/global_config/bash-script-validator/examples/bad-shell.sh +54 -0
- package/skills/global_config/bash-script-validator/examples/good-bash.sh +71 -0
- package/skills/global_config/bash-script-validator/examples/good-shell.sh +69 -0
- package/skills/global_config/bash-script-validator/scripts/run_ci_checks.sh +23 -0
- package/skills/global_config/bash-script-validator/scripts/shellcheck_wrapper.sh +174 -0
- package/skills/global_config/bash-script-validator/scripts/test_validate.sh +446 -0
- package/skills/global_config/bash-script-validator/scripts/validate.sh +512 -0
- package/skills/global_config/ci-pipeline/SKILL.md +135 -0
- package/skills/global_config/dispatching-parallel-agents/SKILL.md +170 -0
- package/skills/global_config/dockerfile-generator/SKILL.md +1038 -0
- package/skills/global_config/dockerfile-generator/examples/example.dockerignore +95 -0
- package/skills/global_config/dockerfile-generator/examples/golang-distroless.Dockerfile +34 -0
- package/skills/global_config/dockerfile-generator/examples/java-springboot.Dockerfile +45 -0
- package/skills/global_config/dockerfile-generator/examples/nextjs-production.Dockerfile +49 -0
- package/skills/global_config/dockerfile-generator/examples/nodejs-multistage.Dockerfile +55 -0
- package/skills/global_config/dockerfile-generator/examples/python-fastapi.Dockerfile +48 -0
- package/skills/global_config/dockerfile-generator/references/language_specific_guides.md +510 -0
- package/skills/global_config/dockerfile-generator/references/multistage_builds.md +570 -0
- package/skills/global_config/dockerfile-generator/references/optimization_patterns.md +492 -0
- package/skills/global_config/dockerfile-generator/references/security_best_practices.md +375 -0
- package/skills/global_config/dockerfile-generator/scripts/generate_dockerignore.sh +199 -0
- package/skills/global_config/dockerfile-generator/scripts/generate_golang.sh +172 -0
- package/skills/global_config/dockerfile-generator/scripts/generate_java.sh +185 -0
- package/skills/global_config/dockerfile-generator/scripts/generate_nodejs.sh +279 -0
- package/skills/global_config/dockerfile-generator/scripts/generate_python.sh +218 -0
- package/skills/global_config/dockerfile-generator/scripts/test_generator.sh +210 -0
- package/skills/global_config/dockerfile-validator/SKILL.md +300 -0
- package/skills/global_config/dockerfile-validator/examples/.dockerignore.example +34 -0
- package/skills/global_config/dockerfile-validator/examples/bad-example.Dockerfile +37 -0
- package/skills/global_config/dockerfile-validator/examples/golang-distroless.Dockerfile +50 -0
- package/skills/global_config/dockerfile-validator/examples/good-example.Dockerfile +52 -0
- package/skills/global_config/dockerfile-validator/examples/python-optimized.Dockerfile +53 -0
- package/skills/global_config/dockerfile-validator/examples/security-issues.Dockerfile +42 -0
- package/skills/global_config/dockerfile-validator/references/docker_best_practices.md +348 -0
- package/skills/global_config/dockerfile-validator/references/optimization_guide.md +473 -0
- package/skills/global_config/dockerfile-validator/references/security_checklist.md +208 -0
- package/skills/global_config/dockerfile-validator/scripts/dockerfile-validate.sh +699 -0
- package/skills/global_config/dockerfile-validator/scripts/test_validate.sh +35 -0
- package/skills/global_config/dockerfile-validator/tests/fixtures/copy-before-yarn-lock-read.Dockerfile +6 -0
- package/skills/global_config/dockerfile-validator/tests/fixtures/copy-before-yarn.Dockerfile +6 -0
- package/skills/global_config/dockerfile-validator/tests/fixtures/from-platform-nonroot.Dockerfile +7 -0
- package/skills/global_config/dockerfile-validator/tests/test_regression.sh +164 -0
- package/skills/global_config/finishing-a-development-branch/SKILL.md +228 -0
- package/skills/global_config/github-actions-generator/SKILL.md +353 -0
- package/skills/global_config/github-actions-generator/assets/templates/action/composite/action.yml +82 -0
- package/skills/global_config/github-actions-generator/assets/templates/action/docker/Dockerfile +25 -0
- package/skills/global_config/github-actions-generator/assets/templates/action/docker/action.yml +42 -0
- package/skills/global_config/github-actions-generator/assets/templates/action/docker/entrypoint.sh +27 -0
- package/skills/global_config/github-actions-generator/assets/templates/action/javascript/action.yml +33 -0
- package/skills/global_config/github-actions-generator/assets/templates/action/javascript/index.js +50 -0
- package/skills/global_config/github-actions-generator/assets/templates/action/javascript/package.json +27 -0
- package/skills/global_config/github-actions-generator/assets/templates/workflow/basic_workflow.yml +242 -0
- package/skills/global_config/github-actions-generator/assets/templates/workflow/reusable_workflow.yml +106 -0
- package/skills/global_config/github-actions-generator/examples/README.md +147 -0
- package/skills/global_config/github-actions-generator/examples/actions/setup-node-cached/action.yml +93 -0
- package/skills/global_config/github-actions-generator/examples/caching/docker-buildkit.yml +256 -0
- package/skills/global_config/github-actions-generator/examples/security/dependency-review.yml +62 -0
- package/skills/global_config/github-actions-generator/examples/security/sbom-attestation.yml +119 -0
- package/skills/global_config/github-actions-generator/examples/triggers/chatops-commands.yml +475 -0
- package/skills/global_config/github-actions-generator/examples/triggers/repository-dispatch.yml +418 -0
- package/skills/global_config/github-actions-generator/examples/triggers/workflow-orchestration.yml +404 -0
- package/skills/global_config/github-actions-generator/examples/workflows/docker-build-push.yml +68 -0
- package/skills/global_config/github-actions-generator/examples/workflows/go-ci.yml +161 -0
- package/skills/global_config/github-actions-generator/examples/workflows/monorepo-ci.yml +340 -0
- package/skills/global_config/github-actions-generator/examples/workflows/multi-environment-deploy.yml +406 -0
- package/skills/global_config/github-actions-generator/examples/workflows/nodejs-ci.yml +122 -0
- package/skills/global_config/github-actions-generator/examples/workflows/python-ci.yml +157 -0
- package/skills/global_config/github-actions-generator/examples/workflows/scheduled-tasks.yml +376 -0
- package/skills/global_config/github-actions-generator/references/advanced-triggers.md +917 -0
- package/skills/global_config/github-actions-generator/references/best-practices.md +755 -0
- package/skills/global_config/github-actions-generator/references/common-actions.md +715 -0
- package/skills/global_config/github-actions-generator/references/custom-actions.md +320 -0
- package/skills/global_config/github-actions-generator/references/expressions-and-contexts.md +688 -0
- package/skills/global_config/github-actions-generator/references/modern-features.md +421 -0
- package/skills/global_config/github-actions-generator/scripts/test_generator.sh +344 -0
- package/skills/global_config/github-actions-templates/SKILL.md +7 -0
- package/skills/global_config/github-actions-validator/SKILL.md +576 -0
- package/skills/global_config/github-actions-validator/examples/README.md +88 -0
- package/skills/global_config/github-actions-validator/examples/outdated-versions.yml +76 -0
- package/skills/global_config/github-actions-validator/examples/valid-ci.yml +79 -0
- package/skills/global_config/github-actions-validator/examples/with-errors.yml +47 -0
- package/skills/global_config/github-actions-validator/references/act_usage.md +233 -0
- package/skills/global_config/github-actions-validator/references/action_versions.md +122 -0
- package/skills/global_config/github-actions-validator/references/actionlint_usage.md +343 -0
- package/skills/global_config/github-actions-validator/references/common_errors.md +512 -0
- package/skills/global_config/github-actions-validator/references/modern_features.md +384 -0
- package/skills/global_config/github-actions-validator/references/runners.md +317 -0
- package/skills/global_config/github-actions-validator/scripts/install_tools.sh +113 -0
- package/skills/global_config/github-actions-validator/scripts/validate_workflow.sh +910 -0
- package/skills/global_config/github-actions-validator/tests/test_validate_workflow.sh +237 -0
- package/skills/global_config/makefile-generator/SKILL.md +614 -0
- package/skills/global_config/makefile-generator/assets/templates/.gitkeep +1 -0
- package/skills/global_config/makefile-generator/docs/makefile-structure.md +530 -0
- package/skills/global_config/makefile-generator/docs/optimization-guide.md +784 -0
- package/skills/global_config/makefile-generator/docs/patterns-guide.md +642 -0
- package/skills/global_config/makefile-generator/docs/security-guide.md +361 -0
- package/skills/global_config/makefile-generator/docs/targets-guide.md +642 -0
- package/skills/global_config/makefile-generator/docs/variables-guide.md +596 -0
- package/skills/global_config/makefile-generator/scripts/add_standard_targets.sh +539 -0
- package/skills/global_config/makefile-generator/scripts/generate_makefile_template.sh +690 -0
- package/skills/global_config/makefile-generator/test/test_helper_scripts.sh +190 -0
- package/skills/global_config/makefile-validator/SKILL.md +244 -0
- package/skills/global_config/makefile-validator/docs/bake-tool.md +1000 -0
- package/skills/global_config/makefile-validator/docs/best-practices.md +858 -0
- package/skills/global_config/makefile-validator/docs/common-mistakes.md +944 -0
- package/skills/global_config/makefile-validator/examples/bad-makefile.mk +77 -0
- package/skills/global_config/makefile-validator/examples/good-makefile.mk +103 -0
- package/skills/global_config/makefile-validator/scripts/test_validate.sh +382 -0
- package/skills/global_config/makefile-validator/scripts/validate_makefile.sh +712 -0
- package/skills/global_config/{MCP_Manage → mcp-manage}/SKILL.md +3 -3
- package/skills/global_config/requesting-code-review/SKILL.md +98 -0
- package/skills/global_config/requesting-code-review/code-reviewer.md +198 -0
- package/skills/global_config/using-git-worktrees/SKILL.md +170 -0
- package/skills/global_config/verification-before-completion/SKILL.md +123 -0
- package/skills/global_config/writing-plans/SKILL.md +126 -46
- package/skills/global_config/writing-plans-legacy/SKILL.md +139 -0
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
#
|
|
3
|
+
# Regression test suite for github-actions-generator
|
|
4
|
+
#
|
|
5
|
+
# Tests:
|
|
6
|
+
# 1. YAML syntax validity — all templates and examples parse without errors
|
|
7
|
+
# 2. SHA pinning compliance — no unpinned @vN action refs in positive examples
|
|
8
|
+
# 3. EOF newlines — all YAML files end with a newline
|
|
9
|
+
# 4. SHA consistency — templates/examples use the canonical SHAs from
|
|
10
|
+
# references/common-actions.md
|
|
11
|
+
# 5. Required workflow keys — example workflows contain mandatory top-level keys
|
|
12
|
+
# 6. Template placeholders — workflow/docker templates keep safe placeholders
|
|
13
|
+
#
|
|
14
|
+
# Prerequisites: yamllint must be installed (pip install yamllint)
|
|
15
|
+
#
|
|
16
|
+
# Exit 0 when all assertions pass; non-zero on any failure.
|
|
17
|
+
#
|
|
18
|
+
|
|
19
|
+
set -euo pipefail
|
|
20
|
+
|
|
21
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
22
|
+
readonly SKILL_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
23
|
+
|
|
24
|
+
PASS=0
|
|
25
|
+
FAIL=0
|
|
26
|
+
|
|
27
|
+
# ─── helpers ────────────────────────────────────────────────────────────────
|
|
28
|
+
|
|
29
|
+
pass() { echo " PASS: $1"; PASS=$((PASS + 1)); }
|
|
30
|
+
fail() { echo " FAIL: $1"; FAIL=$((FAIL + 1)); }
|
|
31
|
+
|
|
32
|
+
assert_true() {
|
|
33
|
+
local label="$1"
|
|
34
|
+
shift
|
|
35
|
+
if "$@" >/dev/null 2>&1; then
|
|
36
|
+
pass "$label"
|
|
37
|
+
else
|
|
38
|
+
fail "$label"
|
|
39
|
+
fi
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
assert_false() {
|
|
43
|
+
local label="$1"
|
|
44
|
+
shift
|
|
45
|
+
if ! "$@" >/dev/null 2>&1; then
|
|
46
|
+
pass "$label"
|
|
47
|
+
else
|
|
48
|
+
fail "$label"
|
|
49
|
+
fi
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
assert_file_contains() {
|
|
53
|
+
local label="$1"
|
|
54
|
+
local file="$2"
|
|
55
|
+
local pattern="$3"
|
|
56
|
+
if grep -qE -- "$pattern" "$file"; then
|
|
57
|
+
pass "$label"
|
|
58
|
+
else
|
|
59
|
+
fail "$label — pattern '$pattern' not found in $file"
|
|
60
|
+
fi
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
assert_file_not_contains() {
|
|
64
|
+
local label="$1"
|
|
65
|
+
local file="$2"
|
|
66
|
+
local pattern="$3"
|
|
67
|
+
if ! grep -qE -- "$pattern" "$file"; then
|
|
68
|
+
pass "$label"
|
|
69
|
+
else
|
|
70
|
+
fail "$label — unexpected pattern '$pattern' found in $file"
|
|
71
|
+
grep -nE -- "$pattern" "$file" | sed 's/^/ /' || true
|
|
72
|
+
fi
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
assert_file_ends_with_newline() {
|
|
76
|
+
local label="$1"
|
|
77
|
+
local file="$2"
|
|
78
|
+
if [ -z "$(tail -c1 "$file")" ]; then
|
|
79
|
+
pass "$label"
|
|
80
|
+
else
|
|
81
|
+
fail "$label — $file is missing a trailing newline"
|
|
82
|
+
fi
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
assert_text_matches_pattern() {
|
|
86
|
+
local label="$1"
|
|
87
|
+
local text="$2"
|
|
88
|
+
local pattern="$3"
|
|
89
|
+
if echo "$text" | grep -qE "$pattern"; then
|
|
90
|
+
pass "$label"
|
|
91
|
+
else
|
|
92
|
+
fail "$label — text did not match pattern '$pattern': $text"
|
|
93
|
+
fi
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
assert_text_not_matches_pattern() {
|
|
97
|
+
local label="$1"
|
|
98
|
+
local text="$2"
|
|
99
|
+
local pattern="$3"
|
|
100
|
+
if ! echo "$text" | grep -qE "$pattern"; then
|
|
101
|
+
pass "$label"
|
|
102
|
+
else
|
|
103
|
+
fail "$label — text unexpectedly matched pattern '$pattern': $text"
|
|
104
|
+
fi
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
# ─── discovery ──────────────────────────────────────────────────────────────
|
|
108
|
+
|
|
109
|
+
# Collect all YAML files under templates and examples
|
|
110
|
+
TEMPLATE_FILES=()
|
|
111
|
+
while IFS= read -r f; do
|
|
112
|
+
TEMPLATE_FILES+=("$f")
|
|
113
|
+
done < <(find "$SKILL_DIR/assets/templates" -name "*.yml" -type f)
|
|
114
|
+
|
|
115
|
+
EXAMPLE_FILES=()
|
|
116
|
+
while IFS= read -r f; do
|
|
117
|
+
EXAMPLE_FILES+=("$f")
|
|
118
|
+
done < <(find "$SKILL_DIR/examples" -name "*.yml" -type f)
|
|
119
|
+
|
|
120
|
+
ALL_YAML_FILES=("${TEMPLATE_FILES[@]}" "${EXAMPLE_FILES[@]}")
|
|
121
|
+
|
|
122
|
+
echo "Discovered ${#TEMPLATE_FILES[@]} template file(s) and ${#EXAMPLE_FILES[@]} example file(s)."
|
|
123
|
+
echo ""
|
|
124
|
+
|
|
125
|
+
# ─── canonical SHAs (sourced from references/common-actions.md) ─────────────
|
|
126
|
+
|
|
127
|
+
# These are the authoritative SHAs the generator must use.
|
|
128
|
+
# If common-actions.md is updated, update these constants to match.
|
|
129
|
+
readonly SHA_CHECKOUT="de0fac2e4500dabe0009e67214ff5f5447ce83dd" # v6.0.2
|
|
130
|
+
readonly SHA_SETUP_NODE="6044e13b5dc448c55e2357c09f80417699197238" # v6.2.0
|
|
131
|
+
readonly SHA_CACHE="cdf6c1fa76f9f475f3d7449005a359c84ca0f306" # v5.0.3
|
|
132
|
+
readonly SHA_UPLOAD_ARTIFACT="5d5d22a31266ced268874388b861e4b58bb5c2f3" # v4.3.1
|
|
133
|
+
readonly SHA_DOWNLOAD_ARTIFACT="c850b930e6ba138125429b7e5c93fc707a7f8427" # v4.1.4
|
|
134
|
+
readonly SHA_GITHUB_SCRIPT="60a0d83039c74a4aee543508d2ffcb1c3799cdea" # v7.0.1
|
|
135
|
+
readonly SHA_DEPENDENCY_REVIEW="05fe4576374b728f0c523d6a13d64c25081e0803" # v4.8.3
|
|
136
|
+
readonly SHA_ATTEST_SBOM="bd218ad0dbcb3e146bd073d1d9c6d78e08aa8a0b" # v2.4.0
|
|
137
|
+
readonly SHA_ATTEST_BUILD_PROVENANCE="e8998f949152b193b063cb0ec769d69d929409be" # v2.4.0
|
|
138
|
+
readonly SHA_CODEQL_ACTION="ae9ef3a1d2e3413523c3741725c30064970cc0d4" # v3.32.5
|
|
139
|
+
|
|
140
|
+
# ─── 1. YAML syntax validity ─────────────────────────────────────────────────
|
|
141
|
+
|
|
142
|
+
echo "[1] YAML syntax validity"
|
|
143
|
+
|
|
144
|
+
if ! command -v yamllint >/dev/null 2>&1; then
|
|
145
|
+
fail "yamllint not installed — skipping YAML syntax checks"
|
|
146
|
+
else
|
|
147
|
+
for f in "${ALL_YAML_FILES[@]}"; do
|
|
148
|
+
rel="${f#"$SKILL_DIR/"}"
|
|
149
|
+
errors=$(yamllint -d relaxed "$f" 2>&1 | grep "error" | grep -v "line-length" || true)
|
|
150
|
+
if [ -z "$errors" ]; then
|
|
151
|
+
pass "valid YAML: $rel"
|
|
152
|
+
else
|
|
153
|
+
fail "YAML error in: $rel"
|
|
154
|
+
echo "$errors" | sed 's/^/ /'
|
|
155
|
+
fi
|
|
156
|
+
done
|
|
157
|
+
fi
|
|
158
|
+
echo ""
|
|
159
|
+
|
|
160
|
+
# ─── 2. SHA pinning compliance ───────────────────────────────────────────────
|
|
161
|
+
|
|
162
|
+
echo "[2] SHA pinning compliance (no bare @vN refs in positive examples)"
|
|
163
|
+
|
|
164
|
+
# Pattern matches mutable tag refs in uses:, including nested action paths.
|
|
165
|
+
# Examples detected:
|
|
166
|
+
# uses: actions/checkout@v6
|
|
167
|
+
# uses: github/codeql-action/upload-sarif@v3
|
|
168
|
+
# uses: owner/repo/sub/path@v1.2.3
|
|
169
|
+
# We check examples/templates only — reference .md files are excluded.
|
|
170
|
+
readonly UNPINNED_PATTERN='^[[:space:]]*uses:[[:space:]]*[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+(/[A-Za-z0-9_.-]+)*@v[0-9]+(\.[0-9]+){0,2}([[:space:]]|$)'
|
|
171
|
+
|
|
172
|
+
echo " [2a] Regex regression checks"
|
|
173
|
+
assert_text_matches_pattern \
|
|
174
|
+
"matches top-level action major tag" \
|
|
175
|
+
" uses: actions/dependency-review-action@v4" \
|
|
176
|
+
"$UNPINNED_PATTERN"
|
|
177
|
+
assert_text_matches_pattern \
|
|
178
|
+
"matches nested action path major tag" \
|
|
179
|
+
" uses: github/codeql-action/upload-sarif@v3" \
|
|
180
|
+
"$UNPINNED_PATTERN"
|
|
181
|
+
assert_text_matches_pattern \
|
|
182
|
+
"matches nested action path semver tag" \
|
|
183
|
+
" uses: owner/repo/sub-path@v3.2.1 # mutable" \
|
|
184
|
+
"$UNPINNED_PATTERN"
|
|
185
|
+
assert_text_not_matches_pattern \
|
|
186
|
+
"does not match full SHA pin" \
|
|
187
|
+
" uses: github/codeql-action/upload-sarif@ae9ef3a1d2e3413523c3741725c30064970cc0d4 # v3.32.5" \
|
|
188
|
+
"$UNPINNED_PATTERN"
|
|
189
|
+
|
|
190
|
+
for f in "${TEMPLATE_FILES[@]}" "${EXAMPLE_FILES[@]}"; do
|
|
191
|
+
rel="${f#"$SKILL_DIR/"}"
|
|
192
|
+
unpinned=$(grep -nE "$UNPINNED_PATTERN" "$f" || true)
|
|
193
|
+
if [ -z "$unpinned" ]; then
|
|
194
|
+
pass "no unpinned refs: $rel"
|
|
195
|
+
else
|
|
196
|
+
fail "unpinned action ref(s) in: $rel"
|
|
197
|
+
echo "$unpinned" | sed 's/^/ /'
|
|
198
|
+
fi
|
|
199
|
+
done
|
|
200
|
+
echo ""
|
|
201
|
+
|
|
202
|
+
# ─── 3. EOF newlines ─────────────────────────────────────────────────────────
|
|
203
|
+
|
|
204
|
+
echo "[3] EOF newlines (all YAML files must end with a newline)"
|
|
205
|
+
|
|
206
|
+
for f in "${ALL_YAML_FILES[@]}"; do
|
|
207
|
+
rel="${f#"$SKILL_DIR/"}"
|
|
208
|
+
assert_file_ends_with_newline "EOF newline: $rel" "$f"
|
|
209
|
+
done
|
|
210
|
+
echo ""
|
|
211
|
+
|
|
212
|
+
# ─── 4. SHA consistency ──────────────────────────────────────────────────────
|
|
213
|
+
|
|
214
|
+
echo "[4] SHA consistency (templates and examples match canonical SHAs)"
|
|
215
|
+
|
|
216
|
+
# Check that wherever a well-known action is used, it uses the canonical SHA.
|
|
217
|
+
# This catches version drift between common-actions.md and the rest of the files.
|
|
218
|
+
|
|
219
|
+
check_sha_consistency() {
|
|
220
|
+
local action="$1"
|
|
221
|
+
local expected_sha="$2"
|
|
222
|
+
local file="$3"
|
|
223
|
+
local rel="${file#"$SKILL_DIR/"}"
|
|
224
|
+
|
|
225
|
+
# Extract all @<sha-or-tag> references for this action
|
|
226
|
+
local wrong
|
|
227
|
+
wrong=$(grep -nE "uses: ${action}@" "$file" 2>/dev/null \
|
|
228
|
+
| grep -v "$expected_sha" \
|
|
229
|
+
| grep -v "# .*BAD\|# .*UNSAFE\|# .*AVOID\|#.*-.*uses:" \
|
|
230
|
+
|| true)
|
|
231
|
+
|
|
232
|
+
if [ -z "$wrong" ]; then
|
|
233
|
+
pass "SHA consistent for ${action}: $rel"
|
|
234
|
+
else
|
|
235
|
+
fail "Wrong SHA for ${action} in: $rel"
|
|
236
|
+
echo "$wrong" | sed 's/^/ /'
|
|
237
|
+
echo " Expected SHA: $expected_sha"
|
|
238
|
+
fi
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
for f in "${TEMPLATE_FILES[@]}" "${EXAMPLE_FILES[@]}"; do
|
|
242
|
+
if grep -qE "uses: actions/checkout@" "$f" 2>/dev/null; then
|
|
243
|
+
check_sha_consistency "actions/checkout" "$SHA_CHECKOUT" "$f"
|
|
244
|
+
fi
|
|
245
|
+
if grep -qE "uses: actions/setup-node@" "$f" 2>/dev/null; then
|
|
246
|
+
check_sha_consistency "actions/setup-node" "$SHA_SETUP_NODE" "$f"
|
|
247
|
+
fi
|
|
248
|
+
if grep -qE "uses: actions/cache@" "$f" 2>/dev/null; then
|
|
249
|
+
check_sha_consistency "actions/cache" "$SHA_CACHE" "$f"
|
|
250
|
+
fi
|
|
251
|
+
if grep -qE "uses: actions/upload-artifact@" "$f" 2>/dev/null; then
|
|
252
|
+
check_sha_consistency "actions/upload-artifact" "$SHA_UPLOAD_ARTIFACT" "$f"
|
|
253
|
+
fi
|
|
254
|
+
if grep -qE "uses: actions/download-artifact@" "$f" 2>/dev/null; then
|
|
255
|
+
check_sha_consistency "actions/download-artifact" "$SHA_DOWNLOAD_ARTIFACT" "$f"
|
|
256
|
+
fi
|
|
257
|
+
if grep -qE "uses: actions/github-script@" "$f" 2>/dev/null; then
|
|
258
|
+
check_sha_consistency "actions/github-script" "$SHA_GITHUB_SCRIPT" "$f"
|
|
259
|
+
fi
|
|
260
|
+
if grep -qE "uses: actions/dependency-review-action@" "$f" 2>/dev/null; then
|
|
261
|
+
check_sha_consistency "actions/dependency-review-action" "$SHA_DEPENDENCY_REVIEW" "$f"
|
|
262
|
+
fi
|
|
263
|
+
if grep -qE "uses: actions/attest-sbom@" "$f" 2>/dev/null; then
|
|
264
|
+
check_sha_consistency "actions/attest-sbom" "$SHA_ATTEST_SBOM" "$f"
|
|
265
|
+
fi
|
|
266
|
+
if grep -qE "uses: actions/attest-build-provenance@" "$f" 2>/dev/null; then
|
|
267
|
+
check_sha_consistency "actions/attest-build-provenance" "$SHA_ATTEST_BUILD_PROVENANCE" "$f"
|
|
268
|
+
fi
|
|
269
|
+
if grep -qE "uses: github/codeql-action/init@" "$f" 2>/dev/null; then
|
|
270
|
+
check_sha_consistency "github/codeql-action/init" "$SHA_CODEQL_ACTION" "$f"
|
|
271
|
+
fi
|
|
272
|
+
if grep -qE "uses: github/codeql-action/analyze@" "$f" 2>/dev/null; then
|
|
273
|
+
check_sha_consistency "github/codeql-action/analyze" "$SHA_CODEQL_ACTION" "$f"
|
|
274
|
+
fi
|
|
275
|
+
if grep -qE "uses: github/codeql-action/upload-sarif@" "$f" 2>/dev/null; then
|
|
276
|
+
check_sha_consistency "github/codeql-action/upload-sarif" "$SHA_CODEQL_ACTION" "$f"
|
|
277
|
+
fi
|
|
278
|
+
done
|
|
279
|
+
echo ""
|
|
280
|
+
|
|
281
|
+
# ─── 5. Required workflow keys ───────────────────────────────────────────────
|
|
282
|
+
|
|
283
|
+
echo "[5] Required workflow keys (name, on, permissions, jobs)"
|
|
284
|
+
|
|
285
|
+
WORKFLOW_EXAMPLES=()
|
|
286
|
+
while IFS= read -r f; do
|
|
287
|
+
WORKFLOW_EXAMPLES+=("$f")
|
|
288
|
+
done < <(find "$SKILL_DIR/examples/workflows" "$SKILL_DIR/assets/templates/workflow" \
|
|
289
|
+
-name "*.yml" -type f)
|
|
290
|
+
|
|
291
|
+
for f in "${WORKFLOW_EXAMPLES[@]}"; do
|
|
292
|
+
rel="${f#"$SKILL_DIR/"}"
|
|
293
|
+
assert_file_contains "has 'name:' key: $rel" "$f" "^name:"
|
|
294
|
+
assert_file_contains "has 'on:' trigger: $rel" "$f" "^on:"
|
|
295
|
+
assert_file_contains "has 'permissions:' key: $rel" "$f" "permissions:"
|
|
296
|
+
assert_file_contains "has 'jobs:' key: $rel" "$f" "^jobs:"
|
|
297
|
+
done
|
|
298
|
+
echo ""
|
|
299
|
+
|
|
300
|
+
# ─── 6. Template placeholder integrity ───────────────────────────────────────
|
|
301
|
+
|
|
302
|
+
echo "[6] Template placeholder integrity"
|
|
303
|
+
|
|
304
|
+
BASIC_TEMPLATE="$SKILL_DIR/assets/templates/workflow/basic_workflow.yml"
|
|
305
|
+
DOCKER_TEMPLATE="$SKILL_DIR/assets/templates/action/docker/Dockerfile"
|
|
306
|
+
|
|
307
|
+
# Verify the step name with brackets is quoted (prevents YAML parse error)
|
|
308
|
+
assert_file_contains \
|
|
309
|
+
"basic_workflow.yml: bracketed step name is quoted" \
|
|
310
|
+
"$BASIC_TEMPLATE" \
|
|
311
|
+
'name: "\[SETUP_STEP_NAME\]'
|
|
312
|
+
|
|
313
|
+
# Verify the file has no raw YAML syntax errors (already covered in test 1,
|
|
314
|
+
# but surfaced here explicitly for the template that had the known bug)
|
|
315
|
+
if command -v yamllint >/dev/null 2>&1; then
|
|
316
|
+
errors=$(yamllint -d relaxed "$BASIC_TEMPLATE" 2>&1 | grep "error" | grep -v "line-length" || true)
|
|
317
|
+
if [ -z "$errors" ]; then
|
|
318
|
+
pass "basic_workflow.yml: no YAML syntax errors"
|
|
319
|
+
else
|
|
320
|
+
fail "basic_workflow.yml: YAML syntax errors found"
|
|
321
|
+
echo "$errors" | sed 's/^/ /'
|
|
322
|
+
fi
|
|
323
|
+
fi
|
|
324
|
+
|
|
325
|
+
assert_file_contains \
|
|
326
|
+
"docker action template: has package-install flags placeholder" \
|
|
327
|
+
"$DOCKER_TEMPLATE" \
|
|
328
|
+
'\[PACKAGE_INSTALL_FLAGS\]'
|
|
329
|
+
|
|
330
|
+
assert_file_not_contains \
|
|
331
|
+
"docker action template: no apt-only hardcoded install flags" \
|
|
332
|
+
"$DOCKER_TEMPLATE" \
|
|
333
|
+
'--no-install-recommends'
|
|
334
|
+
|
|
335
|
+
echo ""
|
|
336
|
+
|
|
337
|
+
# ─── summary ─────────────────────────────────────────────────────────────────
|
|
338
|
+
|
|
339
|
+
echo "Results: $PASS passed, $FAIL failed"
|
|
340
|
+
echo ""
|
|
341
|
+
|
|
342
|
+
if [[ $FAIL -gt 0 ]]; then
|
|
343
|
+
exit 1
|
|
344
|
+
fi
|
|
@@ -5,10 +5,17 @@ category: library
|
|
|
5
5
|
risk: critical
|
|
6
6
|
source: community
|
|
7
7
|
date_added: "2026-02-27"
|
|
8
|
+
deprecated_by: github-actions-generator
|
|
8
9
|
---
|
|
9
10
|
|
|
10
11
|
# GitHub Actions Templates
|
|
11
12
|
|
|
13
|
+
> **Superseded.** `github-actions-generator` (+ `github-actions-validator`) replaces
|
|
14
|
+
> this skill: it generates workflows through a validation loop with a
|
|
15
|
+
> best-practices reference library, where this one is a flat pattern list.
|
|
16
|
+
> Kept for the existing patterns; prefer the generator for anything new.
|
|
17
|
+
> See also `ci-pipeline`, which orchestrates the generator.
|
|
18
|
+
|
|
12
19
|
Production-ready GitHub Actions workflow patterns for testing, building, and deploying applications.
|
|
13
20
|
|
|
14
21
|
## Do not use this skill when
|