Skip to content

GitAuto: A performance of a page (/settings/integrations/jira) is too slow. #61

GitAuto: A performance of a page (/settings/integrations/jira) is too slow.

GitAuto: A performance of a page (/settings/integrations/jira) is too slow. #61

name: Add Screenshot Comparison to PR
on:
pull_request:
# Add these permissions at the top level
permissions:
pull-requests: write
contents: read
jobs:
take-screenshots:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install dependencies
run: |
npm install
npx playwright install --with-deps chromium
# https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/introduction/
- name: Install AWS SDK
run: npm install @aws-sdk/client-s3
- name: Build project
env:
STRIPE_SECRET_KEY: ${{ secrets.STRIPE_SECRET_KEY }}
NEXT_PUBLIC_SUPABASE_URL: ${{ secrets.NEXT_PUBLIC_SUPABASE_URL }}
SUPABASE_SERVICE_ROLE_KEY: ${{ secrets.SUPABASE_SERVICE_ROLE_KEY }}
run: npm run build
# "&" starts the server in the background, don't wait for it to finish, and move on
- name: Start local server
run: npm run start &
- name: Take screenshots (main)
run: node scripts/take-screenshots.mjs main-screenshots/ https://gitauto.ai
# This localhost:3000 is the local server we started earlier
- name: Take screenshots (this branch)
run: node scripts/take-screenshots.mjs branch-screenshots/ http://localhost:3000
# https://github.com/actions/github-script
- name: Post screenshot comparison
uses: actions/github-script@v7
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_S3_BUCKET_NAME: ${{ secrets.AWS_S3_BUCKET_NAME }}
with:
script: |
const { compareScreenshots } = await import('${{ github.workspace }}/scripts/upload-screenshots.mjs');
await compareScreenshots({ github, context });