- Create PSA_Cost_Tracker class with database table for API call logging - Log prompt/completion tokens and estimated cost for every OpenRouter API call - Implement monthly budget system with hard stop (budget of 0 = unlimited) - Add budget checks in validate_peptide_name() and generate_peptide_content() - Add dry_run() method to estimate costs before making API calls - Display monthly usage summary and recent API logs in admin settings - Add monthly_budget setting to admin interface with number input field - Update uninstall.php to drop psa_api_logs table on plugin removal Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
70 lines
1.9 KiB
YAML
Executable File
70 lines
1.9 KiB
YAML
Executable File
name: CI — Lint & Test
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
pull_request:
|
|
branches: [ main ]
|
|
workflow_call:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
# ── PHP Syntax Check ─────────────────────────────────────────────
|
|
lint-php:
|
|
name: PHP Lint (${{ matrix.php }})
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
php: ['7.4', '8.1', '8.3']
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up PHP ${{ matrix.php }}
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: ${{ matrix.php }}
|
|
|
|
- name: Syntax check all PHP files
|
|
run: find . -name '*.php' -not -path './vendor/*' -print0 | xargs -0 -n1 php -l
|
|
|
|
# ── WordPress Coding Standards (PHP CodeSniffer) ──────────────────
|
|
lint-phpcs:
|
|
name: WordPress Coding Standards
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up PHP
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: '8.1'
|
|
|
|
- name: Install Composer dependencies
|
|
run: |
|
|
composer install --no-interaction --prefer-dist --no-progress
|
|
|
|
- name: Run PHPCS with WordPress-Core standard
|
|
run: |
|
|
composer run lint
|
|
|
|
# ── JavaScript Lint ──────────────────────────────────────────────
|
|
lint-js:
|
|
name: JavaScript Linting
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
|
|
- name: Check JavaScript syntax
|
|
run: |
|
|
for f in $(find assets/js -name '*.js' -type f); do
|
|
node --check "$f" || exit 1
|
|
done
|
|
echo "All JavaScript files passed syntax check"
|