Update frontend to AGI theme and fix image loading #1
Workflow file for this run
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: PR Build Check | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| concurrency: | |
| group: "pr-check-${{ github.event.number }}" | |
| cancel-in-progress: true | |
| jobs: | |
| build-check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| lfs: true | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| cache-dependency-path: frontend/package-lock.json | |
| - name: Install dependencies | |
| working-directory: frontend | |
| run: npm ci | |
| - name: Copy static assets | |
| working-directory: frontend | |
| run: | | |
| mkdir -p public/thumbnails public/downsampled public/annotations/nsd | |
| cp -r ../data/thumbnails/* public/thumbnails/ 2>/dev/null || echo "No thumbnails to copy" | |
| cp -r ../images/downsampled/* public/downsampled/ 2>/dev/null || echo "No images to copy" | |
| cp -r ../annotations/nsd/*.json public/annotations/nsd/ 2>/dev/null || echo "No annotations to copy" | |
| - name: Build Next.js site | |
| working-directory: frontend | |
| run: npm run build | |
| - name: Verify build output | |
| run: | | |
| echo "Build completed successfully!" | |
| echo "Output files:" | |
| ls -la frontend/out/ | |
| echo "" | |
| echo "Static assets:" | |
| ls -la frontend/out/thumbnails/ 2>/dev/null | head -5 || echo "No thumbnails" | |
| ls -la frontend/out/downsampled/ 2>/dev/null | head -5 || echo "No downsampled images" | |
| ls -la frontend/out/annotations/nsd/ 2>/dev/null | head -5 || echo "No annotations" | |
| - name: Comment PR with build status | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const body = `## Build Check Passed\n\nThe frontend build completed successfully. Once merged, changes will deploy to: https://annotation-garden.github.io/image-annotation/`; | |
| // Find existing comment | |
| const { data: comments } = await github.rest.issues.listComments({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| }); | |
| const botComment = comments.find(comment => | |
| comment.user.type === 'Bot' && comment.body.includes('Build Check') | |
| ); | |
| if (botComment) { | |
| await github.rest.issues.updateComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| comment_id: botComment.id, | |
| body: body | |
| }); | |
| } else { | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body: body | |
| }); | |
| } |