Skip to content
This repository is currently being migrated. It's locked while the migration is in progress.
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
38 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
c311795
fix: remove pull_request triggers to prevent infinite loop
humancompanion-usds Jan 10, 2026
e865e1f
Update scripts/collect-pattern-adherence.js
humancompanion-usds Jan 29, 2026
9edc7e1
fix: address Copilot security and code quality suggestions
humancompanion-usds Feb 2, 2026
4a0ac8e
Merge branch 'main' into starts-form-pattern-adherence
humancompanion-usds Feb 10, 2026
06abd64
Apply suggestion from @Copilot
humancompanion-usds Feb 10, 2026
52d9cb9
fix: address Copilot review comments on pattern adherence PR
humancompanion-usds Feb 10, 2026
4997277
fix: address second round of Copilot review comments
humancompanion-usds Feb 10, 2026
24b950e
fix: revert pull_request trigger restoration on metrics-dashboard
humancompanion-usds Feb 10, 2026
42371f7
Update docs/plans/2026-01-09-pattern-adherence-tracking.md
humancompanion-usds Feb 10, 2026
0c3510b
Updated run of pattern adherence
humancompanion-usds Feb 10, 2026
65d094a
fix: address third round of Copilot review comments
humancompanion-usds Feb 10, 2026
680f9c8
Update scripts/README.md
humancompanion-usds Feb 10, 2026
529d123
fix: address fourth round of Copilot review comments
humancompanion-usds Feb 10, 2026
9c6278b
fix: address fifth round of Copilot review comments
humancompanion-usds Feb 10, 2026
132defd
Merge branch 'main' into starts-form-pattern-adherence
humancompanion-usds Feb 11, 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
12 changes: 6 additions & 6 deletions .github/workflows/metrics-dashboard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ on:
schedule:
# Run weekly on Fridays at 6 PM UTC (2 PM ET / 1 PM EDT) - after component-library PR is merged
- cron: '0 18 * * 5'
# NOTE: pull_request trigger intentionally removed for most branches — it
# caused infinite loops when the workflow committed updated metrics data back
# to the PR branch, re-triggering itself. The branches-ignore guard below
# prevents runs on automated metrics-update branches. Use workflow_dispatch
# for manual testing on other branches.
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
branches-ignore:
- 'metrics-update-**'
- '*metrics-update*'
paths:
- '.github/workflows/metrics-dashboard.yml'
- 'scripts/collect-issue-metrics.js'
- 'scripts/process-ds-components.js'
- 'scripts/collect-experimental-metrics.js'
- 'pattern-adherence-update-**'
workflow_dispatch:
Comment thread
humancompanion-usds marked this conversation as resolved.
Comment thread
humancompanion-usds marked this conversation as resolved.
Outdated
# Allow manual triggering for testing and on-demand updates
Comment thread
humancompanion-usds marked this conversation as resolved.

Comment thread
humancompanion-usds marked this conversation as resolved.
Expand Down
218 changes: 218 additions & 0 deletions .github/workflows/pattern-adherence.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
name: Update Pattern Adherence Tracking

on:
schedule:
# Run weekly on Mondays at 6 AM UTC (2 AM ET / 1 AM EDT)
Comment thread
humancompanion-usds marked this conversation as resolved.
- cron: '0 6 * * 1'
workflow_dispatch:
# Allow manual triggering for testing and development
Comment thread
humancompanion-usds marked this conversation as resolved.

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')

Comment on lines +14 to +18
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This workflow only runs on schedule and workflow_dispatch, but the job-level if references github.event.head_commit.*, which is not present for those event payloads. This can cause the expression evaluation to fail or behave unexpectedly, preventing the job from running. Consider removing this guard entirely (since there’s no push trigger) or rewriting it to use fields that exist for these events (e.g., github.actor, or gating on github.event_name == 'push').

Suggested change
# 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')

Copilot uses AI. Check for mistakes.
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: '20'

- 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
token: ${{ secrets.VADS_WORKFLOWS }}
path: vets-website
sparse-checkout: |
src/applications
sparse-checkout-cone-mode: false
fetch-depth: 1

Comment thread
humancompanion-usds marked this conversation as resolved.
- 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