Skip to content

Commit 2ed2ada

Browse files
author
John Teague
committed
add monorepo sync gh action
1 parent 52bed4a commit 2ed2ada

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

.github/workflows/sync-monorepo.mjs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { syncfromGithubAction } from 'monorepo-sync';
2+
3+
syncfromGithubAction()
4+
.then(() => {
5+
console.log('Sync completed successfully');
6+
process.exit(0);
7+
})
8+
.catch((error) => {
9+
console.error('Error during sync:', error);
10+
process.exit(1);
11+
});
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Sync Merged PR to Monorepo
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
branches:
7+
- main
8+
- master
9+
10+
jobs:
11+
sync-to-monorepo:
12+
if: github.event.pull_request.merged == true
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: '18'
25+
26+
- name: Install dependencies
27+
# Install project dependencies (including dev dependencies)
28+
run: npm install
29+
30+
- name: Sync to Monorepo
31+
env:
32+
GH_TOKEN: ${{ secrets.MONOREPO_SYNC_TOKEN }}
33+
PR_NUMBER: ${{ github.event.pull_request.number }}
34+
PR_TITLE: ${{ github.event.pull_request.title }}
35+
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
36+
SOURCE_REPO_NAME: ${{ github.event.repository.name }}
37+
MONOREPO_PACKAGE_LOCATION: apps/formio-server
38+
run: |
39+
echo "Syncing PR #${PR_NUMBER}: ${PR_TITLE}"
40+
node .github/workflows/sync-monorepo.mjs

0 commit comments

Comments
 (0)