Skip to content

Commit 74e50f8

Browse files
johnformioJohn Teague
andauthored
Monorepo sync (#1141)
* added monorepo sync action * paramterized package location var * updated gh workflow --------- Co-authored-by: John Teague <[email protected]>
1 parent 25a7aee commit 74e50f8

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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+
env:
15+
GH_TOKEN: ${{ secrets.MONOREPO_SYNC_TOKEN }}
16+
PR_NUMBER: ${{ github.event.pull_request.number }}
17+
PR_TITLE: ${{ github.event.pull_request.title }}
18+
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
19+
SOURCE_REPO_NAME: ${{ github.event.repository.name }}
20+
MONOREPO_PACKAGE_LOCATION: packages/${{ github.event.repository.name }}
21+
MONOREPO_PATH: ${{ github.workspace }}/monorepo
22+
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 1
28+
29+
- name: Setup Node.js
30+
uses: actions/setup-node@v4
31+
with:
32+
node-version: '18'
33+
34+
- name: Install dependencies
35+
# Install project dependencies (including dev dependencies)
36+
run: npm install
37+
- name: Install zx
38+
run: npm install zx
39+
40+
- name: Install monorepo-sync package
41+
run: npm install git+https://github.com/formio/monorepo-sync.git
42+
- name: Clone Monorepo
43+
run: |
44+
gh repo clone formio/formio-monorepo monorepo -- --depth=1
45+
46+
- name: Sync to Monorepo
47+
run: |
48+
echo "Syncing PR #${PR_NUMBER}: ${PR_TITLE}"
49+
node .github/workflows/sync-monorepo.mjs
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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+
});
12+

0 commit comments

Comments
 (0)