Update sync-pr-to-monorepo.yml #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Sync Merged PR to Monorepo | ||
| on: | ||
| pull_request: | ||
| types: [closed] | ||
| branches: | ||
| - main | ||
| - master | ||
| jobs: | ||
| sync-to-monorepo: | ||
| if: github.event.pull_request.merged == true | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| NODE_VERSION: 20.x | ||
| GH_TOKEN: ${{ secrets.MONOREPO_SYNC_TOKEN }} | ||
| PR_NUMBER: ${{ github.event.pull_request.number }} | ||
| PR_TITLE: ${{ github.event.pull_request.title }} | ||
| PR_AUTHOR: ${{ github.event.pull_request.user.login }} | ||
| SOURCE_REPO_NAME: ${{ github.event.repository.name }} | ||
| MONOREPO_PACKAGE_LOCATION: packages/${{ github.event.repository.name }} | ||
| MONOREPO_PATH: ${{ github.workspace }}/monorepo | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 1 | ||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: ${{env.NODE_VERSION}} | ||
| - name: Cache node modules | ||
| uses: actions/cache@v3 | ||
| with: | ||
| path: node_modules | ||
| key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-node- | ||
| - name: Installing dependencies | ||
| if: steps.cache.outputs.cache-hit != 'true' | ||
| uses: borales/actions-yarn@v4 | ||
| with: | ||
| cmd: install --frozen-lockfile | ||
| - name: Install zx | ||
| run: yarn add zx | ||
| - name: Install monorepo-sync package | ||
| run: yarn add git+https://github.com/formio/monorepo-sync.git | ||
| - name: Clone Monorepo | ||
| run: | | ||
| gh repo clone formio/formio-monorepo monorepo -- --depth=1 | ||
| - name: Sync to Monorepo | ||
| run: | | ||
| echo "Syncing PR #${PR_NUMBER}: ${PR_TITLE}" | ||
| node .github/workflows/sync-monorepo.mjs | ||