<aside> ☝
PR testing requires preview environments.
</aside>
Open a PR to add a few GitHub Actions
Add this GitHub Workflow that will be responsible for creating the QA Wolf Semaphore check run. This GitHub Action must be present in your default branch to fully work, since check_suite
event only triggers on the default branch.
name: Persistent QA Wolf Semaphore
on:
pull_request:
types: [opened, reopened, synchronize]
check_suite:
types: [completed]
merge_group:
jobs:
qawolf_check_creation:
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: read
steps:
- name: Create passing check for pull request
if: ${{ github.event_name == 'pull_request' }}
uses: actions/github-script@v6
with:
script: |
await github.rest.checks.create({
owner: context.repo.owner,
repo: context.repo.repo,
name: 'QA Wolf Semaphore',
head_sha: context.payload.pull_request.head.sha,
status: 'completed',
conclusion: 'success',
output: {
title: 'QA Wolf Semaphore',
summary: 'QA Wolf approved PRs by default, expecting E2E test runs in the merge queues.'
}
});
- name: Create in-progress check for merge queue
if: ${{ github.event_name == 'merge_group' }}
uses: actions/github-script@v6
with:
script: |
await github.rest.checks.create({
owner: context.repo.owner,
repo: context.repo.repo,
name: 'QA Wolf Semaphore',
head_sha: context.sha,
status: 'in_progress',
output: {
title: 'QA Wolf Semaphore',
summary: 'Waiting E2E tests in the merge queue'
}
});
- name: Reproduce QA Wolf Status Check
if: ${{ github.event_name == 'check_suite' }}
uses: actions/github-script@v6
with:
script: |
const appName = context.payload.check_suite.app.name;
console.log(`Check suite app name: ${appName}`);
if (appName !== 'QA Wolf') {
console.log(`Skipping check creation for app: ${appName}`);
return;
}
await github.rest.checks.create({
owner: context.repo.owner,
repo: context.repo.repo,
name: 'QA Wolf Semaphore',
head_sha: context.payload.check_suite.after,
status: 'completed',
conclusion: context.payload.check_suite.conclusion,
output: {
title: 'QA Wolf Semaphore',
summary: `Reproducing QAWolf check suite conclusion: ${context.payload.check_suite.conclusion}`
}
});
Add this GitHub Workflow to trigger preview environment testing in the merge queues:
name: Test preview environment
on:
pull_request:
merge_group:
jobs:
test-preview-environment:
name: Trigger wolf tests
runs-on: ubuntu-latest
needs:
- step-that-waits-your-preview-env-to-come-up
steps:
- name: Notify QA Wolf of deployment
uses: qawolf/notify-qawolf-on-deploy-action@v1
if: ${{ github.event_name == 'merge_group' }}
with:
qawolf-api-key: "${{ secrets.QAWOLF_API_KEY }}"
deployment-url: "${{ possible-preview-url }}"
deployment-type: "check-with-support"
# Allow the same PR to be tested multiple times in the merge queue
deduplication-key: "${{ github.ref }}"
secrets:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Merge the PR.
Go into https://github.com/ORG/REPO/settings/rules and create/edit a rule that affects your main branch. Check Require status checks to pass
, and add QA Wolf Semaphore
as a required check.
Your merge queue will only merge after QA Wolf tests pass.