diff --git a/.github/workflows/validate-actions.yml b/.github/workflows/validate-actions.yml new file mode 100644 index 0000000..680be5c --- /dev/null +++ b/.github/workflows/validate-actions.yml @@ -0,0 +1,20 @@ +name: Validate Actions + +on: + pull_request: + push: + branches: + - main + +jobs: + validate: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Run actionlint + uses: rhysd/actionlint@v1 + + - name: Validate action metadata conventions + run: ./scripts/validate-actions.sh diff --git a/README.en.md b/README.en.md index 0699b27..e5d88ab 100644 --- a/README.en.md +++ b/README.en.md @@ -20,6 +20,7 @@ A collection of GitHub Actions for sending notifications about GitHub events to - All actions run on `runs.using: node20`. - Execution entry points in `action.yml` are standardized to `dist/index.js`. - Release artifacts use `ncc` bundles and commit generated `dist/` output. +- CI enforces metadata conventions (`node20`, `dist/index.js`) using `actionlint` + `scripts/validate-actions.sh`. ## πŸ”§ Setup Guide diff --git a/README.md b/README.md index 3b1f1f9..bed914b 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ GitHub μ΄λ²€νŠΈμ— λŒ€ν•œ μ•Œλ¦Όμ„ λ‹€μ–‘ν•œ ν”Œλž«νΌμœΌλ‘œ μ „μ†‘ν•˜λŠ” GitH - λͺ¨λ“  μ•‘μ…˜μ€ `runs.using: node20` κΈ°μ€€μœΌλ‘œ λ™μž‘ν•©λ‹ˆλ‹€. - `action.yml`의 μ‹€ν–‰ μ—”νŠΈλ¦¬λŠ” `dist/index.js`둜 ν†΅μΌλ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€. - 배포 μ‹œ `ncc`둜 λ²ˆλ“€λœ `dist/` μ‚°μΆœλ¬Όμ„ ν•¨κ»˜ μ»€λ°‹ν•˜λŠ” 방식을 μ‚¬μš©ν•©λ‹ˆλ‹€. +- CIμ—μ„œ `actionlint` + `scripts/validate-actions.sh`λ₯Ό 톡해 메타데이터 κ·œμΉ™(`node20`, `dist/index.js`)을 μžλ™ κ²€μ¦ν•©λ‹ˆλ‹€. ## πŸ”§ μ„€μ • 방법 diff --git a/scripts/validate-actions.sh b/scripts/validate-actions.sh new file mode 100755 index 0000000..f084799 --- /dev/null +++ b/scripts/validate-actions.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash +set -euo pipefail + +repo_root="$(cd "$(dirname "$0")/.." && pwd)" +cd "$repo_root" + +failures=0 + +while IFS= read -r -d '' action_file; do + action_dir="$(dirname "$action_file")" + rel="${action_dir#./}" + + using=$(awk -F"'" '/^ using:/{print $2}' "$action_file" | head -n1) + main=$(awk -F"'" '/^ main:/{print $2}' "$action_file" | head -n1) + + if [[ "$using" != "node20" ]]; then + echo "[FAIL] $rel/action.yml: runs.using must be 'node20' (got: ${using:-})" + failures=1 + fi + + if [[ "$main" != "dist/index.js" ]]; then + echo "[FAIL] $rel/action.yml: runs.main must be 'dist/index.js' (got: ${main:-})" + failures=1 + fi + + if [[ ! -f "$action_dir/dist/index.js" ]]; then + echo "[FAIL] $rel/dist/index.js: file is missing" + failures=1 + fi +done < <(find . -maxdepth 2 -type f -name action.yml -print0) + +if [[ $failures -ne 0 ]]; then + exit 1 +fi + +echo "All action metadata checks passed."