Sync Repo to Database #284
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 Repo to Database | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| roadmap_slug: | |
| description: "The slug of the roadmap to sync (e.g., frontend, backend)" | |
| required: true | |
| jobs: | |
| sync-roadmap: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup pnpm@v9 | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9 | |
| run_install: false | |
| - name: Setup Node.js Version 20 (LTS) | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: 'pnpm' | |
| - name: Get all roadmap files | |
| id: roadmap-files | |
| run: | | |
| ROADMAP_DIR="src/data/roadmaps/${{ inputs.roadmap_slug }}" | |
| if [ ! -d "$ROADMAP_DIR" ]; then | |
| echo "Error: Roadmap directory '$ROADMAP_DIR' does not exist" | |
| exit 1 | |
| fi | |
| echo "Getting all files in $ROADMAP_DIR" | |
| ALL_FILES=$(find "$ROADMAP_DIR" -type f | tr '\n' ',') | |
| echo "Files to sync:" | |
| echo "$ALL_FILES" | |
| echo "files=$ALL_FILES" >> $GITHUB_OUTPUT | |
| - name: Install Dependencies | |
| run: | | |
| echo "Installing Dependencies" | |
| pnpm install | |
| - name: Run sync script | |
| run: | | |
| echo "Running sync script for roadmap: ${{ inputs.roadmap_slug }}" | |
| echo "Files: ${{ steps.roadmap-files.outputs.files }}" | |
| npm run sync:repo-to-database -- --files="${{ steps.roadmap-files.outputs.files }}" --secret=${{ secrets.GH_SYNC_SECRET }} |