Skip to content

samuelswank/SMART_

Repository files navigation

GitHub Actions & Scripts

This directory contains GitHub Actions workflows and utility scripts for the S.M.A.R.T. project.

Workflows

workflows/update-routes.yml

Automatically updates the README.md route table when route files change in pull requests.

Triggers:

  • Pull requests targeting main branch
  • When files in routes/**/*.js or app.js are modified

What it does:

  1. Detects route file changes in the PR
  2. Runs the route parser to extract all routes
  3. Updates README.md route table automatically
  4. Commits and pushes the updated README.md to the PR branch with descriptive message
  5. Comments on the PR to notify about the update

Note: For local commits, use the pre-commit hook which automatically appends route info to your commit message.

Commit message format:

docs: update route table

Updated routes from:
  - admin
  - applications
  - app.js

Scripts

scripts/route-parser.js

Node.js script that dynamically parses route definitions and generates the README route table.

Features:

  • Scans all route files in routes/ directory
  • Parses app.js to extract base paths
  • Extracts HTTP methods, paths, views, query params, and auth requirements
  • Intelligently categorizes routes based on existing README structure
  • Updates README.md route table section

Usage:

node .github/scripts/route-parser.js

Logs: Check /tmp/cursor-routes.log for execution logs

What it parses:

  • Route files: router.get(), router.post(), etc.
  • Views: res.render('viewname')
  • Base paths: app.use('/path', router) from app.js
  • Query params: Dynamic params like /:id or req.query usage
  • Auth: validateRole middleware calls

How It Works Together

  1. Pre-commit hook (local) - Updates README before commits
  2. GitHub Actions (PR) - Updates README on pull requests
  3. Route parser - Shared script used by both hooks

All three work together to keep route documentation in sync automatically.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors