Checkly #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'Checkly' | |
on: [deployment_status] | |
env: | |
ENVIRONMENT_URL: ${{ github.event.deployment_status.environment_url }} | |
CHECKLY_API_KEY: ${{ secrets.CHECKLY_API_KEY }} | |
CHECKLY_ACCOUNT_ID: ${{ secrets.CHECKLY_ACCOUNT_ID }} | |
CHECKLY_TEST_ENVIRONMENT: ${{ github.event.deployment_status.environment }} | |
jobs: | |
test-e2e: | |
if: github.event_name == 'deployment_status' && github.event.deployment_status.state == 'success' | |
name: Test E2E on Checkly | |
runs-on: ubuntu-latest | |
environment: | |
name: Preview | |
timeout-minutes: 10 | |
permissions: write-all | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: "${{ github.event.deployment_status.deployment.ref }}" | |
- name: Set branch name # workaround to detect branch name in "deployment_status" actions | |
run: echo "CHECKLY_TEST_REPO_BRANCH=$(git show -s --pretty=%D HEAD | tr -s ',' '\n' | sed 's/^ //' | grep -e 'origin/' | head -1 | sed 's/\origin\///g')" >> $GITHUB_ENV | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 22.x | |
- name: Install dependencies | |
# GH actions runs NPM 6. Somehow NPM CI fails with Cannot read property 'babel-core' of undefined | |
run: npm ci | |
- name: Validate checkly config | |
run: npx checkly deploy --preview | |
- name: Run checks | |
id: run-checks | |
run: npx checkly test -e ENVIRONMENT_URL=${{ env.ENVIRONMENT_URL }} --record --reporter=github | |
- id: create-summary | |
if: always() | |
run: cat checkly-github-report.md > $GITHUB_STEP_SUMMARY | |
- id: post-comment-summary | |
uses: marocchino/sticky-pull-request-comment@v2 | |
with: | |
header: Checkly Run Summary | |
path: checkly-github-report.md | |
hide_and_recreate: true | |
hide_classify: "OUTDATED" | |
- name: Deploy checks | |
if: steps.run-checks.outcome == 'success' && github.event.deployment_status.environment == 'Production' | |
run: npx checkly deploy --force |