I have what I think is a fairly common use case, using Github actions.
On pull requests, I want to deploy a branch preview, and once it’s deployed, I want to run e2e or storybook tests against it.
The only way I know how to do this, is a kind polling solution, I use a modified version of this: GitHub - JakePartusch/wait-for-netlify-action: A GitHub action that will wait until a Netlify Preview deploy has completed before continuing on
Storybook mentions a Github deployment_status
event in their documentation here: Test runner | Storybook docs
This seems like a much tidier solution:
- Netlify does it branch deployments
- Emits a deployment_status = success event.
- We wait for that event, and run our tests then.
However, I’ve tried this:
name: Wait for netlify deploy
on: deployment_status
jobs:
test:
runs-on: ubuntu-latest
if: github.event.deployment_status.state == 'success'
steps:
- name: Hello World
run: echo hello world! $TARGET_URL
env:
TARGET_URL: '${{ github.event.deployment_status.target_url }}'
And it doesn’t work.
This thread Can Netlify deliver "deploy" event to GitHub API after successful deployment?
Suggests that this is not supported behaviour.
Is this still the case, or am I missing something? How do I do an event based triggering of my tests after Netlify’s branch preview is complete?