Is polling really the best solution to 'wait for branch preview'?

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:

  1. Netlify does it branch deployments
  2. Emits a deployment_status = success event.
  3. 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?

Yes, polling is the documented way to check the status of a particular deploy: Get started with the Netlify API | Netlify Docs. Or, I don’t know if it’s possible to start something like a webhook listener in GitHub Actions, but if there’s a way to do that, you can trigger a webhook once your deploy is done.

Is it on Netlify’s roadmap to emit a Github native deployment_status event?

Nothing of that sort is planned in the short term.