Skip to content

Fix dark theme text visibility in presentations - ensure text colors … #197

Fix dark theme text visibility in presentations - ensure text colors …

Fix dark theme text visibility in presentations - ensure text colors … #197

name: Dependency Check and CI
on:
schedule:
- cron: "0 0 * * 0"
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
permissions:
pull-requests: write
contents: read
jobs:
dependency-audit:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x]
name: Dependency Audit and Security Check
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache-dependency-path: '**/package-lock.json'
- name: Cache node_modules
id: cache-npm
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-npm-
- name: Install dependencies
if: steps.cache-npm.outputs.cache-hit != 'true'
run: npm ci || (echo "Retrying npm install..." && rm -rf node_modules && npm install)
- name: Check for outdated dependencies (informational)
run: |
echo "Checking for outdated dependencies..."
npm outdated || true
echo "Note: This is for information only and won't fail the build"
- name: Audit dependencies for vulnerabilities
run: npm audit --audit-level=moderate || echo "Audit completed with warnings"
continue-on-error: true
- name: Check for security advisories
run: npm audit --audit-level=high --production || echo "Audit completed with warnings"
test-and-build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache-dependency-path: '**/package-lock.json'
- name: Cache node_modules
id: cache-npm
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-npm-
- name: Install dependencies
if: steps.cache-npm.outputs.cache-hit != 'true'
run: npm ci || (echo "Retrying npm install..." && rm -rf node_modules && npm install)
- name: Run tests with Jest
run: |
if npm pkg get scripts.test | grep -qv null; then
echo "Running Jest tests..."
npx jest
else
echo "No test script found in package.json, skipping tests"
fi
- name: Check if build script exists and build
run: |
if npm run build --silent 2>/dev/null; then
echo "Running build..."
npm run build
else
echo "No build script found in package.json, skipping build"
fi
- name: Run type checking (if TypeScript)
run: echo "TypeScript compilation is handled during build time by Next.js"
dependabot-auto-merge:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' && github.actor == 'dependabot[bot]'
needs: [dependency-audit, test-and-build]
steps:
- name: Check if PR is from Dependabot
id: check-dependabot
run: |
if [[ "${{ github.actor }}" == "dependabot[bot]" ]]; then
echo "is_dependabot=true" >> $GITHUB_OUTPUT
else
echo "is_dependabot=false" >> $GITHUB_OUTPUT
fi
- name: Verify Dependabot updates
if: steps.check-dependabot.outputs.is_dependabot == 'true'
run: npm audit --audit-level=moderate || echo "Audit completed with warnings"
continue-on-error: true
- name: Auto-approve Dependabot PR
if: steps.check-dependabot.outputs.is_dependabot == 'true'
uses: actions/github-script@v7
with:
script: |
github.rest.pulls.createReview({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
event: 'APPROVE',
body: 'Auto-approved by CI workflow as all checks passed ✅'
});
- name: Enable auto-merge for Dependabot PR
if: steps.check-dependabot.outputs.is_dependabot == 'true'
uses: actions/github-script@v7
with:
script: |
github.rest.pulls.update({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
auto_merge: {
merge_method: 'squash'
}
});