248 lines
8.3 KiB
YAML
248 lines
8.3 KiB
YAML
name: PR Checks
|
|
|
|
on:
|
|
pull_request:
|
|
|
|
permissions: {}
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
# Pre-check job to detect automated PRs
|
|
check-automated:
|
|
name: Check Automated PR
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
outputs:
|
|
is_automated: ${{ steps.check.outputs.is_automated }}
|
|
category: ${{ steps.check.outputs.category }}
|
|
skip_reason: ${{ steps.check.outputs.skip_reason }}
|
|
# Skip CI for release/sync/action-update PRs, but NOT for dependency updates (which need testing)
|
|
should_skip_ci: ${{ steps.check.outputs.is_automated == 'true' && steps.check.outputs.category != 'deps' }}
|
|
steps:
|
|
- uses: bullfrogsec/bullfrog@1831f79cce8ad602eef14d2163873f27081ebfb3 # v0.8.4
|
|
|
|
- name: Checkout repository (for composite action)
|
|
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
|
with:
|
|
sparse-checkout: .github/actions
|
|
sparse-checkout-cone-mode: false
|
|
persist-credentials: false
|
|
|
|
- name: Check for automated PR
|
|
id: check
|
|
uses: ./.github/actions/check-automated-pr
|
|
with:
|
|
branch_name: ${{ github.head_ref }}
|
|
pr_title: ${{ github.event.pull_request.title }}
|
|
|
|
validate:
|
|
name: Validate Installation & Build
|
|
needs: check-automated
|
|
# Skip for automated PRs except dependency updates (which should still run tests)
|
|
if: ${{ needs.check-automated.outputs.should_skip_ci != 'true' }}
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
env:
|
|
# Override nx.json defaultBase for PR target branch
|
|
NX_BASE: origin/${{ github.base_ref }}
|
|
NX_HEAD: HEAD
|
|
|
|
steps:
|
|
- uses: bullfrogsec/bullfrog@1831f79cce8ad602eef14d2163873f27081ebfb3 # v0.8.4
|
|
|
|
- name: Checkout repository
|
|
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
|
with:
|
|
fetch-depth: 0
|
|
persist-credentials: false
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
|
|
with:
|
|
node-version: ${{ vars.NODE_VERSION || '22' }}
|
|
cache: 'npm'
|
|
|
|
- name: Install npm
|
|
env:
|
|
NPM_VERSION: ${{ vars.NPM_VERSION || '11.7.0' }}
|
|
# nosemgrep: uniswap.npm-package-in-action-not-pinned-to-commit-sha -- npm CLI from npm registry, not a git-hosted action
|
|
run: npm install -g "npm@$NPM_VERSION"
|
|
|
|
- name: Verify package-lock.json
|
|
run: |
|
|
echo "Checking if package-lock.json is up to date..."
|
|
npm install --package-lock-only
|
|
if ! git diff --exit-code package-lock.json; then
|
|
echo "❌ package-lock.json is out of sync!"
|
|
echo "Please run 'npm install' and commit the updated package-lock.json"
|
|
exit 1
|
|
fi
|
|
echo "✅ package-lock.json is up to date"
|
|
|
|
- name: Clean install dependencies
|
|
run: |
|
|
echo "Running npm ci to validate clean installation..."
|
|
npm ci --prefer-offline --no-audit
|
|
echo "✅ npm ci completed successfully"
|
|
|
|
# Pin nx via --package to prevent local bin shadowing from malicious PRs.
|
|
# Update the version here when upgrading nx in package.json.
|
|
- name: Build changed packages
|
|
run: |
|
|
echo "Building changed packages..."
|
|
npx --package=nx@22.0.2 -- nx affected --target=build --verbose
|
|
echo "✅ Build(s) completed successfully"
|
|
|
|
- name: Run linting
|
|
run: |
|
|
echo "Running linters..."
|
|
npx --package=nx@22.0.2 -- nx affected --target=lint --verbose
|
|
echo "✅ Linting passed"
|
|
|
|
- name: Check formatting
|
|
run: |
|
|
echo "Checking code formatting..."
|
|
npx --package=nx@22.0.2 -- nx format:check --base=$NX_BASE --head=$NX_HEAD
|
|
echo "✅ Formatting check passed"
|
|
|
|
- name: Install Vale
|
|
run: |
|
|
echo "Installing Vale..."
|
|
wget https://github.com/errata-ai/vale/releases/download/v3.0.7/vale_3.0.7_Linux_64-bit.tar.gz
|
|
tar -xvzf vale_3.0.7_Linux_64-bit.tar.gz
|
|
sudo mv vale /usr/local/bin/
|
|
vale --version
|
|
|
|
- name: Lint documentation prose (Vale)
|
|
continue-on-error: true
|
|
run: |
|
|
echo "Checking documentation prose quality..."
|
|
vale docs/ || echo "::warning::Vale found documentation issues - see output above"
|
|
|
|
- name: Run tests
|
|
run: |
|
|
echo "Running tests..."
|
|
npx --package=nx@22.0.2 -- nx affected --target=test --parallel=3 --coverage --verbose
|
|
echo "✅ Tests passed"
|
|
|
|
validate-plugins:
|
|
name: Validate Plugins
|
|
needs: check-automated
|
|
# Skip for automated PRs except dependency updates (which should still run tests)
|
|
if: ${{ needs.check-automated.outputs.should_skip_ci != 'true' }}
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
|
|
steps:
|
|
- uses: bullfrogsec/bullfrog@1831f79cce8ad602eef14d2163873f27081ebfb3 # v0.8.4
|
|
|
|
- name: Checkout repository
|
|
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
|
|
with:
|
|
node-version: ${{ vars.NODE_VERSION || '22' }}
|
|
|
|
- name: Validate all plugins
|
|
uses: ./.github/actions/validate-plugins
|
|
with:
|
|
marketplace-path: '.claude-plugin/marketplace.json'
|
|
fail-on-warning: 'false'
|
|
|
|
validate-skills:
|
|
name: Validate Skills
|
|
needs: check-automated
|
|
if: ${{ needs.check-automated.outputs.should_skip_ci != 'true' }}
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
|
|
steps:
|
|
- uses: bullfrogsec/bullfrog@1831f79cce8ad602eef14d2163873f27081ebfb3 # v0.8.4
|
|
|
|
- name: Checkout repository
|
|
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
|
|
with:
|
|
node-version: ${{ vars.NODE_VERSION || '22' }}
|
|
|
|
- name: Validate skills
|
|
uses: ./.github/actions/validate-skills
|
|
|
|
validate-docs:
|
|
name: Validate Documentation
|
|
needs: check-automated
|
|
if: ${{ needs.check-automated.outputs.should_skip_ci != 'true' }}
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
|
|
steps:
|
|
- uses: bullfrogsec/bullfrog@1831f79cce8ad602eef14d2163873f27081ebfb3 # v0.8.4
|
|
|
|
- name: Checkout repository
|
|
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
|
|
with:
|
|
node-version: ${{ vars.NODE_VERSION || '22' }}
|
|
|
|
- name: Validate documentation pages
|
|
uses: ./.github/actions/validate-docs
|
|
|
|
check-eval-coverage:
|
|
name: Check Eval Coverage
|
|
needs: check-automated
|
|
if: ${{ needs.check-automated.outputs.should_skip_ci != 'true' }}
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
|
|
steps:
|
|
- uses: bullfrogsec/bullfrog@1831f79cce8ad602eef14d2163873f27081ebfb3 # v0.8.4
|
|
|
|
- name: Checkout repository
|
|
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
|
with:
|
|
fetch-depth: 0
|
|
persist-credentials: false
|
|
|
|
- name: Check eval coverage for changed skills
|
|
uses: ./.github/actions/check-eval-coverage
|
|
with:
|
|
base-ref: origin/${{ github.base_ref }}
|
|
require-coverage: 'true'
|
|
|
|
# Summary job for automated PRs that were skipped
|
|
skipped-summary:
|
|
name: CI Skipped (Automated PR)
|
|
needs: check-automated
|
|
if: ${{ needs.check-automated.outputs.should_skip_ci == 'true' }}
|
|
runs-on: ubuntu-latest
|
|
permissions: {}
|
|
steps:
|
|
- uses: bullfrogsec/bullfrog@1831f79cce8ad602eef14d2163873f27081ebfb3 # v0.8.4
|
|
|
|
- name: Report skipped status
|
|
env:
|
|
SKIP_REASON: ${{ needs.check-automated.outputs.skip_reason }}
|
|
run: |
|
|
echo "::notice::CI checks skipped for automated PR: $SKIP_REASON"
|
|
echo "✅ Automated PR detected - CI checks are not required for this PR type."
|