R
Railway2mo ago
Mike

GitHub deployment trigger doesn't fire for "success"

I'm working on a GitHub workflow that runs e2e tests against a preview deployment that is automatically created & updated by Railway. I want to leverage the deployment_status GitHub workflow trigger and further narrow it down to the success type. In other words, only trigger that workflow when Railway successfully deployed a new deployment. The issue I have is that for some reason my workflow gets triggered twice with action: "created", once when the deployment starts and once when it finishes. The second one should be a action: "success". Can anyone confirm that or is it a user error on my side? I'll post a sample workflow yaml in the thread.
4 Replies
Percy
Percy2mo ago
Project ID: 9f09cbdf-5436-4eda-9997-dcc4b5391f40
Mike
Mike2mo ago
9f09cbdf-5436-4eda-9997-dcc4b5391f40 Sample workflow file:
name: Playwright Tests
on:
deployment_status
# NOTE: If this is uncommented, the workflow never triggers
# types: [success]
env:
PR_DEPLOYMENT_URL: ${{ github.event.deployment_status.environment_url }}
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- name: Debugging
run: echo "Debugging - ${{ toJson(github.event) }}"
- uses: actions/checkout@v4
if: ${{ github.event.deployment.payload.serviceId == '396857de-3201-4e79-8386-ce492a329840' && github.event.deployment.production_environment == false }}
- uses: actions/setup-node@v4
if: ${{ github.event.deployment.payload.serviceId == '396857de-3201-4e79-8386-ce492a329840' && github.event.deployment.production_environment == false }}
with:
node-version: lts/*
- name: Install dependencies
if: ${{ github.event.deployment.payload.serviceId == '396857de-3201-4e79-8386-ce492a329840' && github.event.deployment.production_environment == false }}
run: npm install -g pnpm && pnpm install
- name: Install Playwright Browsers
if: ${{ github.event.deployment.payload.serviceId == '396857de-3201-4e79-8386-ce492a329840' && github.event.deployment.production_environment == false }}
run: pnpm exec playwright install --with-deps
working-directory: ./packages/website
- name: Run Playwright tests
if: ${{ github.event.deployment.payload.serviceId == '396857de-3201-4e79-8386-ce492a329840' && github.event.deployment.production_environment == false }}
run: pnpm exec playwright test
working-directory: ./packages/website
- uses: actions/upload-artifact@v4
if: ${{ always() && github.event.deployment.payload.serviceId == '396857de-3201-4e79-8386-ce492a329840' && github.event.deployment.production_environment == false }}
with:
name: playwright-report
path: playwright-report/

name: Playwright Tests
on:
deployment_status
# NOTE: If this is uncommented, the workflow never triggers
# types: [success]
env:
PR_DEPLOYMENT_URL: ${{ github.event.deployment_status.environment_url }}
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- name: Debugging
run: echo "Debugging - ${{ toJson(github.event) }}"
- uses: actions/checkout@v4
if: ${{ github.event.deployment.payload.serviceId == '396857de-3201-4e79-8386-ce492a329840' && github.event.deployment.production_environment == false }}
- uses: actions/setup-node@v4
if: ${{ github.event.deployment.payload.serviceId == '396857de-3201-4e79-8386-ce492a329840' && github.event.deployment.production_environment == false }}
with:
node-version: lts/*
- name: Install dependencies
if: ${{ github.event.deployment.payload.serviceId == '396857de-3201-4e79-8386-ce492a329840' && github.event.deployment.production_environment == false }}
run: npm install -g pnpm && pnpm install
- name: Install Playwright Browsers
if: ${{ github.event.deployment.payload.serviceId == '396857de-3201-4e79-8386-ce492a329840' && github.event.deployment.production_environment == false }}
run: pnpm exec playwright install --with-deps
working-directory: ./packages/website
- name: Run Playwright tests
if: ${{ github.event.deployment.payload.serviceId == '396857de-3201-4e79-8386-ce492a329840' && github.event.deployment.production_environment == false }}
run: pnpm exec playwright test
working-directory: ./packages/website
- uses: actions/upload-artifact@v4
if: ${{ always() && github.event.deployment.payload.serviceId == '396857de-3201-4e79-8386-ce492a329840' && github.event.deployment.production_environment == false }}
with:
name: playwright-report
path: playwright-report/

Brody
Brody2mo ago
does this use the project webhooks?
Mike
Mike2mo ago
No, these events are fired when Railway sets the PR status check for deployments. All I enabled was Railway PR environments.
Want results from more Discord servers?
Add your server