Skip to content

Commit

Permalink
πŸš€ (e2e): e2e test trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
thlmenezes committed Aug 16, 2022
1 parent e0b5443 commit 15125ee
Showing 1 changed file with 11 additions and 36 deletions.
47 changes: 11 additions & 36 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
name: E2E Tests

on: [deployment_status]
on:
issue_comment:
types: [edited]

jobs:
test:
# run job on successful preview deploys
if: github.event.deployment_status.environment == 'Preview' && github.event.deployment_status.state == 'success'
if: github.event.issue.pull_request
runs-on: ubuntu-latest
steps:
- name: πŸ— Setup repo
Expand All @@ -23,39 +24,13 @@ jobs:
yarn workspaces focus @labfaz/e2e
npx playwright install --with-deps
- name: Capture Vercel preview URL
id: vercelPreview
uses: aaron-binary/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: πŸ₯’πŸŽ­ Run E2E Tests
run: yarn workspace @labfaz/e2e test:all
env:
BROWSER_URL: ${{ github.event.deployment_status.target_url }}

# https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#job-status-check-functions
- name: E2E Tests βœ…
if: ${{ success() }}
# set the merge commit status check
# using GitHub REST API
# see https://docs.github.com/en/rest/reference/repos#create-a-commit-status
run: |
curl --request POST \
--url https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }} \
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
--header 'content-type: application/json' \
--data '{
"context": "e2e",
"state": "success",
"description": "E2E tests passed",
"target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}'
- name: E2E Tests 🚨
if: ${{ failure() }}
run: |
curl --request POST \
--url https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }} \
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
--header 'content-type: application/json' \
--data '{
"context": "e2e",
"state": "failure",
"description": "E2E tests failed",
"target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}'
BROWSER_URL: ${{ steps.vercelPreview.outputs.vercel_preview_url }}

0 comments on commit 15125ee

Please sign in to comment.