---
name: ADR Validation
"on":
pull_request:
paths:
- 'docs/adr/**'
push:
branches: [main, master]
paths:
- 'docs/adr/**'
workflow_dispatch:
permissions:
contents: read
pull-requests: write
jobs:
validate:
name: Validate ADRs
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Validate ADR Format
uses: zircote/adrscope@15b8b2658badb6ee22bc1cac797dcb503dd0c2a5
with:
command: validate
input-dir: docs/adr
pattern: "[0-9]*.md"
- name: Get ADR Statistics
uses: zircote/adrscope@15b8b2658badb6ee22bc1cac797dcb503dd0c2a5
with:
command: stats
input-dir: docs/adr
- name: Comment on PR
if: github.event_name == 'pull_request'
uses: >-
actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd
with:
script: |
const fs = require('fs');
const statsFile = 'adr-stats.json';
if (!fs.existsSync(statsFile)) {
console.log('No stats file generated');
return;
}
const stats = JSON.parse(fs.readFileSync(statsFile, 'utf8'));
const comment = `## ADR Validation Results
📊 **Statistics:**
- Total ADRs: ${stats.total || 0}
- Accepted: ${stats.accepted || 0}
- Proposed: ${stats.proposed || 0}
- Deprecated: ${stats.deprecated || 0}
- Superseded: ${stats.superseded || 0}
✅ All ADRs validated successfully!`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment
});