From 8fa00f3577b9db280afc07742128a9e517e4f19b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8C=E1=85=A5=E1=86=BC=E1=84=8B=E1=85=B5=E1=86=AB?= =?UTF-8?q?=E1=84=80=E1=85=AF=E1=86=AB?= Date: Tue, 7 Apr 2026 22:41:57 +0900 Subject: [PATCH] chore: add action metadata consistency validation --- .github/workflows/metadata-consistency.yml | 15 ++++++++ README.en.md | 7 ++++ README.md | 7 ++++ scripts/validate-actions-metadata.sh | 42 ++++++++++++++++++++++ 4 files changed, 71 insertions(+) create mode 100644 .github/workflows/metadata-consistency.yml create mode 100755 scripts/validate-actions-metadata.sh diff --git a/.github/workflows/metadata-consistency.yml b/.github/workflows/metadata-consistency.yml new file mode 100644 index 0000000..a5b5a72 --- /dev/null +++ b/.github/workflows/metadata-consistency.yml @@ -0,0 +1,15 @@ +name: Metadata Consistency + +on: + pull_request: + push: + branches: + - main + +jobs: + validate-action-metadata: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Validate action.yml runtime and dist entry + run: bash scripts/validate-actions-metadata.sh diff --git a/README.en.md b/README.en.md index 0699b27..7c45c41 100644 --- a/README.en.md +++ b/README.en.md @@ -20,6 +20,13 @@ 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. +- Metadata consistency is automatically validated in `.github/workflows/metadata-consistency.yml` on PRs and pushes to `main`. + +You can run the same check locally with: + +```bash +bash scripts/validate-actions-metadata.sh +``` ## πŸ”§ Setup Guide diff --git a/README.md b/README.md index 3b1f1f9..985cb77 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,13 @@ GitHub μ΄λ²€νŠΈμ— λŒ€ν•œ μ•Œλ¦Όμ„ λ‹€μ–‘ν•œ ν”Œλž«νΌμœΌλ‘œ μ „μ†‘ν•˜λŠ” GitH - λͺ¨λ“  μ•‘μ…˜μ€ `runs.using: node20` κΈ°μ€€μœΌλ‘œ λ™μž‘ν•©λ‹ˆλ‹€. - `action.yml`의 μ‹€ν–‰ μ—”νŠΈλ¦¬λŠ” `dist/index.js`둜 ν†΅μΌλ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€. - 배포 μ‹œ `ncc`둜 λ²ˆλ“€λœ `dist/` μ‚°μΆœλ¬Όμ„ ν•¨κ»˜ μ»€λ°‹ν•˜λŠ” 방식을 μ‚¬μš©ν•©λ‹ˆλ‹€. +- PR/메인 브랜치 ν‘Έμ‹œ μ‹œ `.github/workflows/metadata-consistency.yml`μ—μ„œ 메타데이터 정합성을 μžλ™ κ²€μ¦ν•©λ‹ˆλ‹€. + +λ‘œμ»¬μ—μ„œλ„ μ•„λž˜ λͺ…λ ΉμœΌλ‘œ 동일 검증을 μ‹€ν–‰ν•  수 μžˆμŠ΅λ‹ˆλ‹€. + +```bash +bash scripts/validate-actions-metadata.sh +``` ## πŸ”§ μ„€μ • 방법 diff --git a/scripts/validate-actions-metadata.sh b/scripts/validate-actions-metadata.sh new file mode 100755 index 0000000..6cef3ef --- /dev/null +++ b/scripts/validate-actions-metadata.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash +set -euo pipefail + +ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)" +cd "$ROOT_DIR" + +shopt -s nullglob + +action_files=(notify-*/action.yml) +if [ ${#action_files[@]} -eq 0 ]; then + echo "No action.yml files found under notify-* directories." + exit 1 +fi + +fail=0 + +for file in "${action_files[@]}"; do + dir="$(dirname "$file")" + using="$(sed -nE "s/^[[:space:]]*using:[[:space:]]*'?(node[0-9]+)'?[[:space:]]*$/\1/p" "$file" | head -n1)" + main="$(sed -nE "s/^[[:space:]]*main:[[:space:]]*'?(dist\/index\.js)'?[[:space:]]*$/\1/p" "$file" | head -n1)" + + if [ "$using" != "node20" ]; then + echo "[ERROR] $file -> runs.using must be node20 (found: ${using:-})" + fail=1 + fi + + if [ "$main" != "dist/index.js" ]; then + echo "[ERROR] $file -> runs.main must be dist/index.js (found: ${main:-})" + fail=1 + fi + + if [ ! -f "$dir/dist/index.js" ]; then + echo "[ERROR] $file -> $dir/dist/index.js is missing" + fail=1 + fi +done + +if [ "$fail" -ne 0 ]; then + exit 1 +fi + +echo "All action metadata checks passed (${#action_files[@]} actions)." \ No newline at end of file