mirror of
https://github.com/twentyhq/twenty.git
synced 2026-04-18 14:01:45 -04:00
## Summary - Visual regression dispatch was failing for external contributor PRs because fork PRs don't have access to repo secrets (`CI_PRIVILEGED_DISPATCH_TOKEN`) - Moved the dispatch from inline jobs in `ci-front.yaml` / `ci-ui.yaml` to a new `workflow_run`-triggered workflow - `workflow_run` runs in the base repo context and always has access to secrets, regardless of whether the PR is from a fork - Follows the same pattern already used by `post-ci-comments.yaml` for breaking changes dispatch - Handles the fork case where `workflow_run.pull_requests` is empty by falling back to a head label search ## Test plan - [ ] Verify CI Front and CI UI workflows still pass without the removed jobs - [ ] Verify the new `visual-regression-dispatch.yaml` triggers after CI Front / CI UI complete - [ ] Test with a fork PR to confirm the dispatch succeeds
113 lines
3.2 KiB
YAML
113 lines
3.2 KiB
YAML
name: CI UI
|
|
|
|
on:
|
|
pull_request:
|
|
merge_group:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
|
|
|
|
jobs:
|
|
changed-files-check:
|
|
if: github.event_name != 'merge_group'
|
|
uses: ./.github/workflows/changed-files.yaml
|
|
with:
|
|
files: |
|
|
package.json
|
|
yarn.lock
|
|
packages/twenty-ui/**
|
|
packages/twenty-shared/**
|
|
ui-task:
|
|
needs: changed-files-check
|
|
if: needs.changed-files-check.outputs.any_changed == 'true'
|
|
timeout-minutes: 30
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
task: [lint, typecheck, test]
|
|
steps:
|
|
- name: Cancel Previous Runs
|
|
uses: styfle/cancel-workflow-action@0.11.0
|
|
with:
|
|
access_token: ${{ github.token }}
|
|
- name: Fetch custom Github Actions and base branch history
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 10
|
|
- name: Install dependencies
|
|
uses: ./.github/actions/yarn-install
|
|
- name: Run ${{ matrix.task }}
|
|
run: npx nx ${{ matrix.task }} twenty-ui
|
|
ui-sb-build:
|
|
needs: changed-files-check
|
|
if: needs.changed-files-check.outputs.any_changed == 'true'
|
|
timeout-minutes: 30
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Cancel Previous Runs
|
|
uses: styfle/cancel-workflow-action@0.11.0
|
|
with:
|
|
access_token: ${{ github.token }}
|
|
- name: Fetch custom Github Actions and base branch history
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 10
|
|
- name: Install dependencies
|
|
uses: ./.github/actions/yarn-install
|
|
- name: Build storybook
|
|
run: npx nx storybook:build twenty-ui
|
|
- name: Upload storybook build
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: storybook-twenty-ui
|
|
path: packages/twenty-ui/storybook-static
|
|
retention-days: 1
|
|
ui-sb-test:
|
|
timeout-minutes: 30
|
|
runs-on: ubuntu-latest
|
|
needs: ui-sb-build
|
|
env:
|
|
STORYBOOK_URL: http://localhost:6007
|
|
steps:
|
|
- name: Fetch custom Github Actions and base branch history
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 10
|
|
- name: Install dependencies
|
|
uses: ./.github/actions/yarn-install
|
|
- name: Build dependencies
|
|
run: npx nx build twenty-shared
|
|
- name: Download storybook build
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: storybook-twenty-ui
|
|
path: packages/twenty-ui/storybook-static
|
|
- name: Install Playwright
|
|
run: |
|
|
cd packages/twenty-ui
|
|
npx playwright install
|
|
- name: Serve storybook & run tests
|
|
run: |
|
|
npx http-server packages/twenty-ui/storybook-static --port 6007 --silent &
|
|
timeout 30 bash -c 'until curl -sf http://localhost:6007 > /dev/null 2>&1; do sleep 1; done'
|
|
npx nx storybook:test twenty-ui
|
|
ci-ui-status-check:
|
|
if: always() && !cancelled()
|
|
timeout-minutes: 5
|
|
runs-on: ubuntu-latest
|
|
needs:
|
|
[
|
|
changed-files-check,
|
|
ui-task,
|
|
ui-sb-build,
|
|
ui-sb-test,
|
|
]
|
|
steps:
|
|
- name: Fail job if any needs failed
|
|
if: contains(needs.*.result, 'failure')
|
|
run: exit 1
|