Skip to content

feat: add target url from vercel prview and run the tests only if the… #6

feat: add target url from vercel prview and run the tests only if the…

feat: add target url from vercel prview and run the tests only if the… #6

Workflow file for this run

name: "Shortest Tests"
on:
deployment_status
jobs:
shortest:
# Only run when:
# 1. It's a successful deployment
# 2. It's from Vercel (vercel.app in URL)
# 3. It's a preview deployment (not production)
if: |
github.event.deployment_status.state == 'success' &&
contains(github.event.deployment_status.target_url, 'vercel.app') &&
github.event.deployment.environment == 'Preview'
runs-on: ubuntu-latest
steps:
# Add timeout to ensure we don't wait forever

Check failure on line 18 in .github/workflows/shortest.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/shortest.yml

Invalid workflow file

You have an error in your yaml syntax on line 18
timeout-minutes: 15
# Cancel any in-progress jobs if a new deployment comes in
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Get Vercel preview URL
id: vercel_url
run: |
DEPLOY_URL="${{ github.event.deployment_status.target_url }}"
# Verify the URL is accessible
curl --retry 3 --retry-delay 1 -f "$DEPLOY_URL" || exit 1
echo "url=$DEPLOY_URL" >> $GITHUB_OUTPUT
- name: Run Shortest tests
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
run: pnpm shortest --headless --target=${{ steps.vercel_url.outputs.url }}