From 92eb849f03c0cfcadd04ad2116827acf0a5f653d 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: Sun, 5 Apr 2026 22:41:35 +0900 Subject: [PATCH] chore: enforce action metadata consistency checks --- .github/workflows/metadata-lint.yml | 22 +++++++++++++++ README.en.md | 1 + README.md | 1 + notify-on-failure/action.yml | 2 +- scripts/validate-action-metadata.sh | 42 +++++++++++++++++++++++++++++ 5 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/metadata-lint.yml create mode 100755 scripts/validate-action-metadata.sh diff --git a/.github/workflows/metadata-lint.yml b/.github/workflows/metadata-lint.yml new file mode 100644 index 0000000..0073576 --- /dev/null +++ b/.github/workflows/metadata-lint.yml @@ -0,0 +1,22 @@ +name: Metadata Lint + +on: + pull_request: + push: + branches: + - main + +jobs: + validate-metadata: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Run repository metadata checks + run: ./scripts/validate-action-metadata.sh + + - name: actionlint + uses: reviewdog/actionlint@v1 + with: + fail_on_error: true diff --git a/README.en.md b/README.en.md index 0699b27..7e452e3 100644 --- a/README.en.md +++ b/README.en.md @@ -19,6 +19,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`. +- `.github/workflows/metadata-lint.yml` checks metadata consistency in CI using `scripts/validate-action-metadata.sh` + `actionlint`. - Release artifacts use `ncc` bundles and commit generated `dist/` output. ## πŸ”§ Setup Guide diff --git a/README.md b/README.md index 3b1f1f9..2437870 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ GitHub μ΄λ²€νŠΈμ— λŒ€ν•œ μ•Œλ¦Όμ„ λ‹€μ–‘ν•œ ν”Œλž«νΌμœΌλ‘œ μ „μ†‘ν•˜λŠ” GitH - λͺ¨λ“  μ•‘μ…˜μ€ `runs.using: node20` κΈ°μ€€μœΌλ‘œ λ™μž‘ν•©λ‹ˆλ‹€. - `action.yml`의 μ‹€ν–‰ μ—”νŠΈλ¦¬λŠ” `dist/index.js`둜 ν†΅μΌλ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€. +- `.github/workflows/metadata-lint.yml`μ—μ„œ `scripts/validate-action-metadata.sh` + `actionlint`둜 메타데이터 정합성을 CIμ—μ„œ μ κ²€ν•©λ‹ˆλ‹€. - 배포 μ‹œ `ncc`둜 λ²ˆλ“€λœ `dist/` μ‚°μΆœλ¬Όμ„ ν•¨κ»˜ μ»€λ°‹ν•˜λŠ” 방식을 μ‚¬μš©ν•©λ‹ˆλ‹€. ## πŸ”§ μ„€μ • 방법 diff --git a/notify-on-failure/action.yml b/notify-on-failure/action.yml index 8fc36a0..17e4341 100644 --- a/notify-on-failure/action.yml +++ b/notify-on-failure/action.yml @@ -18,4 +18,4 @@ inputs: required: false runs: using: 'node20' - main: 'dist/index.js' \ No newline at end of file + main: 'dist/index.js' diff --git a/scripts/validate-action-metadata.sh b/scripts/validate-action-metadata.sh new file mode 100755 index 0000000..cf6dc12 --- /dev/null +++ b/scripts/validate-action-metadata.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash +set -euo pipefail + +ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +cd "$ROOT_DIR" + +expected_runtime="node20" +expected_main="dist/index.js" + +status=0 + +for action_file in notify-*/action.yml; do + if [[ ! -f "$action_file" ]]; then + continue + fi + + action_dir="$(dirname "$action_file")" + runtime="$(awk -F": " '/^[[:space:]]*using:/ {gsub(/'"'"'/, "", $2); print $2; exit}' "$action_file")" + main="$(awk -F": " '/^[[:space:]]*main:/ {gsub(/'"'"'/, "", $2); print $2; exit}' "$action_file")" + + if [[ "$runtime" != "$expected_runtime" ]]; then + echo "[FAIL] $action_file runs.using must be '$expected_runtime' (found: '${runtime:-}')" + status=1 + fi + + if [[ "$main" != "$expected_main" ]]; then + echo "[FAIL] $action_file runs.main must be '$expected_main' (found: '${main:-}')" + status=1 + fi + + if [[ ! -f "$action_dir/$expected_main" ]]; then + echo "[FAIL] $action_dir/$expected_main does not exist" + status=1 + fi + +done + +if [[ $status -eq 0 ]]; then + echo "[OK] All action metadata files use runs.using=$expected_runtime and runs.main=$expected_main" +fi + +exit $status