Skip to content
This repository is currently being migrated. It's locked while the migration is in progress.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
8c42d4e
feat: add pattern metadata parser
humancompanion-usds Jan 9, 2026
06af1a3
fix: improve error handling in pattern parser
humancompanion-usds Jan 9, 2026
e9451c3
feat: add pattern file discovery
humancompanion-usds Jan 9, 2026
1520ee9
feat: add product directory integration
humancompanion-usds Jan 9, 2026
7cded70
fix: improve robustness of product directory integration
humancompanion-usds Jan 9, 2026
9359483
feat: add vets-website import analysis
humancompanion-usds Jan 9, 2026
8bd0469
fix: address security vulnerability and improve robustness in import …
humancompanion-usds Jan 9, 2026
5880968
feat: build pattern-to-forms mapping
humancompanion-usds Jan 9, 2026
51b155d
fix: improve robustness and performance of pattern mapping
humancompanion-usds Jan 9, 2026
58a0df9
feat: add report generation
humancompanion-usds Jan 9, 2026
324ef49
perf: optimize report generation
humancompanion-usds Jan 9, 2026
5129527
chore: add initial pattern adherence analysis results
humancompanion-usds Jan 9, 2026
a7118ed
feat: improve pattern detection and add local vets-website support
humancompanion-usds Jan 9, 2026
34b0830
chore: update pattern adherence reports with accurate detection
humancompanion-usds Jan 9, 2026
e95fb36
feat: add special detection for Signature pattern (statementOfTruth)
humancompanion-usds Jan 9, 2026
4e5eaef
feat: add GitHub Actions workflow for weekly pattern adherence tracking
humancompanion-usds Jan 9, 2026
0469ec6
fix: handle inconsistent leading slashes in path extraction
humancompanion-usds Jan 9, 2026
8fa03c4
docs: add comprehensive documentation for pattern adherence script
humancompanion-usds Jan 9, 2026
015b737
security: prevent shell injection in GitHub API file fetching
humancompanion-usds Jan 9, 2026
31fb004
fix: correct checkout parameter in workflow (depth -> fetch-depth)
humancompanion-usds Jan 9, 2026
d92dfac
fix: pass GITHUB_TOKEN for private repo access and use execFileSync
humancompanion-usds Jan 9, 2026
1252b46
fix: use GH_TOKEN for gh CLI authentication in pattern adherence work…
humancompanion-usds Jan 10, 2026
062f36d
fix: use unique branch names to avoid collisions on multiple runs
humancompanion-usds Jan 10, 2026
438c1ee
📊 Update pattern adherence data - 2026-01-10
actions-user Jan 10, 2026
642f5d1
📊 Update pattern adherence data - 2026-01-10
actions-user Jan 10, 2026
9c5dfc6
📊 Update pattern adherence data - 2026-01-10
actions-user Jan 10, 2026
c63e5cc
📊 Update pattern adherence data - 2026-01-10
actions-user Jan 10, 2026
d8155b0
📊 Update pattern adherence data - 2026-01-10
actions-user Jan 10, 2026
76bced0
📊 Update pattern adherence data - 2026-01-10
actions-user Jan 10, 2026
e84966b
📊 Update pattern adherence data - 2026-01-10
actions-user Jan 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
226 changes: 226 additions & 0 deletions .github/workflows/pattern-adherence.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,226 @@
name: Update Pattern Adherence Tracking

on:
schedule:
# Run weekly on Mondays at 6 AM UTC (2 AM ET / 1 AM EDT)
- cron: '0 6 * * 1'
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
branches-ignore:
- 'pattern-adherence-update-**'
- '*pattern-adherence*'
paths:
- '.github/workflows/pattern-adherence.yml'
- 'scripts/collect-pattern-adherence.js'
- 'src/_patterns/**/*.md'
workflow_dispatch:
# Allow manual triggering for testing

jobs:
update-pattern-adherence:
runs-on: ubuntu-latest

# Skip if last commit was made by GitHub Action
if: |
github.event.head_commit.author.email != 'action@github.com' &&
!contains(github.event.head_commit.message, '📊 Update pattern adherence data')

permissions:
contents: write
pull-requests: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.VADS_WORKFLOWS }}
ref: ${{ github.head_ref || github.ref_name }}
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'

- name: Skip dependency installation
run: |
echo "📝 Pattern adherence script uses built-in Node.js modules only"
echo "🚀 Skipping yarn install to avoid dependency conflicts"
echo "✅ Node.js $(node --version) is ready"

- name: Setup GitHub CLI
run: |
echo "Using pre-installed GitHub CLI"
gh --version
env:
GITHUB_TOKEN: ${{ secrets.VADS_WORKFLOWS }}

- name: Verify GitHub CLI authentication
run: |
gh auth status
gh api user --jq '.login'
env:
GITHUB_TOKEN: ${{ secrets.VADS_WORKFLOWS }}

- name: Checkout vets-website (sparse - src/applications only)
uses: actions/checkout@v4
with:
repository: department-of-veterans-affairs/vets-website
path: vets-website
sparse-checkout: |
src/applications
sparse-checkout-cone-mode: false
fetch-depth: 1

- name: Create data directories
run: |
mkdir -p src/assets/data/metrics
mkdir -p src/_data/metrics

- name: Collect pattern adherence data
run: |
echo "Starting pattern adherence analysis..."
node scripts/collect-pattern-adherence.js --vets-website-path vets-website
echo "Pattern adherence analysis completed"
env:
GH_TOKEN: ${{ secrets.VADS_WORKFLOWS }}

- name: Verify generated data files
run: |
echo "Checking for generated files..."
ls -la src/assets/data/metrics/

if [ -f "src/assets/data/metrics/pattern-adherence.json" ]; then
echo "✅ pattern-adherence.json generated"
echo "File size: $(du -h src/assets/data/metrics/pattern-adherence.json)"
else
echo "❌ pattern-adherence.json not found"
exit 1
fi

if [ -f "src/assets/data/metrics/pattern-adherence-report.md" ]; then
echo "✅ pattern-adherence-report.md generated"
echo "File size: $(du -h src/assets/data/metrics/pattern-adherence-report.md)"
else
echo "❌ pattern-adherence-report.md not found"
exit 1
fi

- name: Check for changes
id: git-check
run: |
git add src/assets/data/metrics/pattern-adherence.json
git add src/assets/data/metrics/pattern-adherence-report.md
git add src/_data/metrics/pattern-adherence.json

if git diff --staged --quiet; then
echo "changes=false" >> $GITHUB_OUTPUT
echo "No changes detected"
else
echo "changes=true" >> $GITHUB_OUTPUT
echo "Changes detected"
git diff --staged --stat
fi

- name: Create branch and commit changes
if: steps.git-check.outputs.changes == 'true'
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"

CURRENT_DATE=$(date -u '+%Y-%m-%d')
BRANCH_NAME="pattern-adherence-update-${CURRENT_DATE}-${{ github.run_id }}"

git checkout -b "$BRANCH_NAME"

TOTAL_PATTERNS=$(jq -r '.total_patterns // "unknown"' src/assets/data/metrics/pattern-adherence.json)
TOTAL_FORMS=$(jq -r '.total_forms // "unknown"' src/assets/data/metrics/pattern-adherence.json)

git commit -m "📊 Update pattern adherence data - ${CURRENT_DATE}

- Analyzed ${TOTAL_PATTERNS} codified patterns
- Tracked ${TOTAL_FORMS} VA.gov forms
- Updated pattern-to-forms mapping
- Generated compliance reports

🤖 Automated update via GitHub Actions"

git push origin "$BRANCH_NAME"

echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV

- name: Create Pull Request
if: steps.git-check.outputs.changes == 'true'
run: |
CURRENT_DATE=$(date -u '+%Y-%m-%d %H:%M UTC')

PR_BODY="## Summary
Automated weekly update of pattern adherence tracking data.

### What Changed
- Pattern-to-forms mapping updated
- Compliance percentages recalculated
- Forms × Patterns matrix regenerated

### Files Updated
- \`src/assets/data/metrics/pattern-adherence.json\`
- \`src/assets/data/metrics/pattern-adherence-report.md\`
- \`src/_data/metrics/pattern-adherence.json\`

### Test Plan
- [ ] Verify JSON structure is valid
- [ ] Check markdown report renders correctly
- [ ] Review compliance percentages for accuracy

🤖 Generated with automated workflow - ${CURRENT_DATE}"

gh pr create \
--title "📊 Update pattern adherence data - $(date -u '+%Y-%m-%d')" \
--body "$PR_BODY" \
--head "$BRANCH_NAME" \
--base main

PR_URL=$(gh pr view "$BRANCH_NAME" --json url --jq '.url')
echo "PR_URL=$PR_URL" >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.VADS_WORKFLOWS }}

- name: Create summary
if: always()
run: |
echo "## 📊 Pattern Adherence Update Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY

if [ -f "src/assets/data/metrics/pattern-adherence.json" ]; then
TOTAL_PATTERNS=$(jq -r '.total_patterns // "unknown"' src/assets/data/metrics/pattern-adherence.json)
TOTAL_FORMS=$(jq -r '.total_forms // "unknown"' src/assets/data/metrics/pattern-adherence.json)

echo "### ✅ Pattern Adherence Data Updated" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "- **Patterns Analyzed:** ${TOTAL_PATTERNS}" >> $GITHUB_STEP_SUMMARY
echo "- **Forms Tracked:** ${TOTAL_FORMS}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY

if [ "${{ steps.git-check.outputs.changes }}" == "true" ]; then
echo "### 🚀 Pull Request Created" >> $GITHUB_STEP_SUMMARY
if [ -n "${PR_URL:-}" ]; then
echo "**PR URL:** $PR_URL" >> $GITHUB_STEP_SUMMARY
fi
else
echo "### ℹ️ No Changes" >> $GITHUB_STEP_SUMMARY
echo "Pattern adherence data is up to date." >> $GITHUB_STEP_SUMMARY
fi
else
echo "### ❌ Update Failed" >> $GITHUB_STEP_SUMMARY
echo "Pattern adherence data was not generated." >> $GITHUB_STEP_SUMMARY
fi

echo "" >> $GITHUB_STEP_SUMMARY
echo "### 📅 Next Update" >> $GITHUB_STEP_SUMMARY
echo "Next automatic update: Monday 6 AM UTC" >> $GITHUB_STEP_SUMMARY

- name: Notify on failure
if: failure()
run: |
echo "❌ Pattern adherence workflow failed"
echo "Check logs for details"
Loading
Loading