|
| 1 | +name: Sync Content to Repo |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + roadmap_slug: |
| 7 | + description: "The ID of the roadmap to sync" |
| 8 | + required: true |
| 9 | + default: "__default__" |
| 10 | + |
| 11 | +jobs: |
| 12 | + sync-content: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - uses: actions/checkout@v4 |
| 16 | + |
| 17 | + - name: Setup pnpm@v9 |
| 18 | + uses: pnpm/action-setup@v4 |
| 19 | + with: |
| 20 | + version: 9 |
| 21 | + run_install: false |
| 22 | + |
| 23 | + - name: Setup Node.js Version 20 (LTS) |
| 24 | + uses: actions/setup-node@v4 |
| 25 | + with: |
| 26 | + node-version: 20 |
| 27 | + cache: 'pnpm' |
| 28 | + |
| 29 | + - name: Install Dependencies and Sync Content |
| 30 | + run: | |
| 31 | + echo "Installing Dependencies" |
| 32 | + pnpm install |
| 33 | + echo "Syncing Content to Repo" |
| 34 | + npm run sync:content-to-repo -- --roadmap-slug=${{ inputs.roadmap_slug }} --secret=${{ secrets.GH_SYNC_SECRET }} |
| 35 | +
|
| 36 | + - name: Check for changes |
| 37 | + id: verify-changed-files |
| 38 | + run: | |
| 39 | + if [ -n "$(git status --porcelain)" ]; then |
| 40 | + echo "changed=true" >> $GITHUB_OUTPUT |
| 41 | + else |
| 42 | + echo "changed=false" >> $GITHUB_OUTPUT |
| 43 | + fi |
| 44 | + |
| 45 | + - name: Create PR |
| 46 | + if: steps.verify-changed-files.outputs.changed == 'true' |
| 47 | + uses: peter-evans/create-pull-request@v7 |
| 48 | + with: |
| 49 | + delete-branch: false |
| 50 | + branch: "chore/sync-content-to-repo-${{ inputs.roadmap_slug }}" |
| 51 | + base: "master" |
| 52 | + labels: | |
| 53 | + automated pr |
| 54 | + reviewers: jcanalesluna,kamranahmedse |
| 55 | + commit-message: "chore: sync content to repo" |
| 56 | + title: "chore: sync content to repository - ${{ inputs.roadmap_slug }}" |
| 57 | + body: | |
| 58 | + ## Sync Content to Repo |
| 59 | + |
| 60 | + > [!IMPORTANT] |
| 61 | + > This PR Syncs the Content to the Repo for the Roadmap: ${{ inputs.roadmap_slug }} |
| 62 | + > |
| 63 | + > Commit: ${{ github.sha }} |
| 64 | + > Workflow Path: ${{ github.workflow_ref }} |
| 65 | +
|
| 66 | + **Please Review the Changes and Merge the PR if everything is fine.** |
0 commit comments