Compare commits

...

2 Commits

Author SHA1 Message Date
Cursor Agent
9af9dc84e9 feat: Trigger CI on VRT update and checkout PR branch
Co-authored-by: matiss <matiss@mja.lv>
2025-10-18 17:30:19 +00:00
Cursor Agent
57710006e0 Add CI checks to VRT update workflow
Co-authored-by: matiss <matiss@mja.lv>
2025-10-18 17:26:22 +00:00
3 changed files with 66 additions and 2 deletions

View File

@@ -12,6 +12,8 @@ on:
branches:
- master
pull_request:
repository_dispatch:
types: [vrt-update-applied]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
@@ -22,6 +24,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# For repository_dispatch events, checkout the PR branch
ref: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.head_ref || github.ref }}
repository: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.head_repo || github.repository }}
- name: Set up environment
uses: ./.github/actions/setup
- name: Build API
@@ -38,6 +44,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# For repository_dispatch events, checkout the PR branch
ref: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.head_ref || github.ref }}
repository: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.head_repo || github.repository }}
- name: Set up environment
uses: ./.github/actions/setup
- name: Build CRDT
@@ -54,6 +64,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# For repository_dispatch events, checkout the PR branch
ref: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.head_ref || github.ref }}
repository: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.head_repo || github.repository }}
- name: Set up environment
uses: ./.github/actions/setup
- name: Build Web
@@ -73,6 +87,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# For repository_dispatch events, checkout the PR branch
ref: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.head_ref || github.ref }}
repository: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.head_repo || github.repository }}
- name: Set up environment
uses: ./.github/actions/setup
- name: Build Server

View File

@@ -5,6 +5,8 @@ on:
branches:
- master
pull_request:
repository_dispatch:
types: [vrt-update-applied]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
@@ -15,6 +17,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# For repository_dispatch events, checkout the PR branch
ref: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.head_ref || github.ref }}
repository: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.head_repo || github.repository }}
- name: Set up environment
uses: ./.github/actions/setup
- name: Lint
@@ -23,6 +29,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# For repository_dispatch events, checkout the PR branch
ref: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.head_ref || github.ref }}
repository: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.head_repo || github.repository }}
- name: Set up environment
uses: ./.github/actions/setup
- name: Typecheck
@@ -31,6 +41,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# For repository_dispatch events, checkout the PR branch
ref: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.head_ref || github.ref }}
repository: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.head_repo || github.repository }}
- name: Set up environment
uses: ./.github/actions/setup
- name: Build Web
@@ -41,16 +55,24 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# For repository_dispatch events, checkout the PR branch
ref: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.head_ref || github.ref }}
repository: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.head_repo || github.repository }}
- name: Set up environment
uses: ./.github/actions/setup
- name: Test
run: yarn test
migrations:
if: github.event_name == 'pull_request'
if: github.event_name == 'pull_request' || github.event_name == 'repository_dispatch'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# For repository_dispatch events, checkout the PR branch
ref: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.head_ref || github.ref }}
repository: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.head_repo || github.repository }}
- uses: actions/setup-node@v4
with:
node-version: 20

View File

@@ -130,6 +130,30 @@ jobs:
git push origin "HEAD:refs/heads/$HEAD_REF"
echo "Successfully pushed VRT updates to $HEAD_REPO@$HEAD_REF"
- name: Trigger CI workflows
if: steps.apply.outputs.applied == 'true'
uses: actions/github-script@v7
with:
script: |
// Dispatch a custom event to trigger CI workflows
// This will cause the CI workflows to run in the PR context
try {
await github.rest.repos.createDispatchEvent({
owner: context.repo.owner,
repo: context.repo.repo,
event_type: 'vrt-update-applied',
client_payload: {
pr_number: ${{ steps.metadata.outputs.pr_number }},
head_ref: '${{ steps.metadata.outputs.head_ref }}',
head_repo: '${{ steps.metadata.outputs.head_repo }}'
}
});
console.log('Successfully triggered CI workflows via repository_dispatch');
} catch (error) {
console.log(`Failed to trigger CI workflows: ${error.message}`);
}
- name: Comment on PR - Success
if: steps.apply.outputs.applied == 'true'
uses: actions/github-script@v7
@@ -139,7 +163,7 @@ jobs:
issue_number: ${{ steps.metadata.outputs.pr_number }},
owner: context.repo.owner,
repo: context.repo.repo,
body: '✅ VRT screenshots have been automatically updated.'
body: '✅ VRT screenshots have been automatically updated and CI workflows have been triggered.'
});
- name: Comment on PR - Failure