|
1 | 1 | name: Sync Merged PR to Monorepo |
2 | 2 |
|
3 | 3 | on: |
4 | | - pull_request: |
5 | | - types: [closed] |
6 | | - branches: |
7 | | - - main |
8 | | - - master |
| 4 | + pull_request: |
| 5 | + types: [closed] |
| 6 | + branches: |
| 7 | + - main |
| 8 | + - master |
9 | 9 |
|
10 | 10 | jobs: |
11 | | - sync-to-monorepo: |
12 | | - if: github.event.pull_request.merged == true |
13 | | - runs-on: ubuntu-latest |
14 | | - env: |
15 | | - NODE_VERSION: 20.x |
16 | | - GH_TOKEN: ${{ secrets.MONOREPO_SYNC_TOKEN }} |
17 | | - PR_NUMBER: ${{ github.event.pull_request.number }} |
18 | | - PR_TITLE: ${{ github.event.pull_request.title }} |
19 | | - PR_AUTHOR: ${{ github.event.pull_request.user.login }} |
20 | | - SOURCE_REPO_NAME: ${{ github.event.repository.name }} |
21 | | - MONOREPO_PACKAGE_LOCATION: packages/${{ github.event.repository.name }} |
22 | | - MONOREPO_PATH: ${{ github.workspace }}/monorepo |
23 | | - |
24 | | - steps: |
25 | | - - name: Checkout repository |
26 | | - uses: actions/checkout@v4 |
27 | | - with: |
28 | | - fetch-depth: 1 |
29 | | - |
30 | | - - name: Setup Node.js |
31 | | - uses: actions/setup-node@v4 |
32 | | - with: |
33 | | - node-version: ${{env.NODE_VERSION}} |
34 | | - |
35 | | - - name: Cache node modules |
36 | | - uses: actions/cache@v3 |
37 | | - with: |
38 | | - path: node_modules |
39 | | - key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }} |
40 | | - restore-keys: | |
41 | | - ${{ runner.os }}-node- |
42 | | -
|
43 | | - - name: Installing dependencies |
44 | | - if: steps.cache.outputs.cache-hit != 'true' |
45 | | - uses: borales/actions-yarn@v4 |
46 | | - with: |
47 | | - cmd: install --frozen-lockfile |
48 | | - |
49 | | - - name: Install zx |
50 | | - run: yarn add zx |
51 | | - |
52 | | - - name: Install monorepo-sync package |
53 | | - run: yarn add git+https://github.com/formio/monorepo-sync.git |
54 | | - |
55 | | - - name: Clone Monorepo |
56 | | - run: | |
57 | | - gh repo clone formio/formio-monorepo monorepo -- --depth=1 |
58 | | - |
59 | | - - name: Sync to Monorepo |
60 | | - run: | |
61 | | - echo "Syncing PR #${PR_NUMBER}: ${PR_TITLE}" |
62 | | - node .github/workflows/sync-monorepo.mjs |
| 11 | + sync-to-monorepo: |
| 12 | + if: github.event.pull_request.merged == true |
| 13 | + runs-on: ubuntu-latest |
| 14 | + env: |
| 15 | + NODE_VERSION: 20.x |
| 16 | + GH_TOKEN: ${{ secrets.MONOREPO_SYNC_TOKEN }} |
| 17 | + PR_NUMBER: ${{ github.event.pull_request.number }} |
| 18 | + PR_TITLE: ${{ github.event.pull_request.title }} |
| 19 | + PR_AUTHOR: ${{ github.event.pull_request.user.login }} |
| 20 | + SOURCE_REPO_NAME: ${{ github.event.repository.name }} |
| 21 | + MONOREPO_PACKAGE_LOCATION: packages/${{ github.event.repository.name }} |
| 22 | + MONOREPO_PATH: ${{ github.workspace }}/monorepo |
| 23 | + |
| 24 | + steps: |
| 25 | + - name: Checkout repository |
| 26 | + uses: actions/checkout@v4 |
| 27 | + with: |
| 28 | + fetch-depth: 1 |
| 29 | + |
| 30 | + - name: Setup Node.js |
| 31 | + uses: actions/setup-node@v4 |
| 32 | + with: |
| 33 | + node-version: ${{env.NODE_VERSION}} |
| 34 | + |
| 35 | + - name: Cache node modules |
| 36 | + uses: actions/cache@v3 |
| 37 | + with: |
| 38 | + path: node_modules |
| 39 | + key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }} |
| 40 | + restore-keys: | |
| 41 | + ${{ runner.os }}-node- |
| 42 | +
|
| 43 | + - name: Installing dependencies |
| 44 | + if: steps.cache.outputs.cache-hit != 'true' |
| 45 | + uses: borales/actions-yarn@v4 |
| 46 | + with: |
| 47 | + cmd: install --frozen-lockfile |
| 48 | + |
| 49 | + - name: Install zx |
| 50 | + run: yarn add zx |
| 51 | + |
| 52 | + - name: Install monorepo-sync package |
| 53 | + run: yarn add git+https://github.com/formio/monorepo-sync.git |
| 54 | + |
| 55 | + - name: Clone Monorepo |
| 56 | + run: | |
| 57 | + gh repo clone formio/formio-monorepo monorepo -- --depth=1 |
| 58 | +
|
| 59 | + - name: Sync to Monorepo |
| 60 | + run: | |
| 61 | + echo "Syncing PR #${PR_NUMBER}: ${PR_TITLE}" |
| 62 | + node .github/workflows/sync-monorepo.mjs |
| 63 | +
|
63 | 64 | #update |
0 commit comments