Preserve PR preview files in main branch deployment#31
Preserve PR preview files in main branch deployment#31likeajumprope merged 2 commits intoReproNim:mainfrom
Conversation
Add keep_files: true to peaceiris/actions-gh-pages so that pushes to main do not wipe the pr-previews/ directory from gh-pages, allowing PR preview deployments to coexist with production. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Code Review
This pull request updates the training materials data and the compiled frontend assets. Several issues were identified in the data updates, including inconsistent data types for the course_length field and the introduction of redundant null keys in the JSON data. Additionally, build artifacts from the dist/ directory are being committed to the repository, which should ideally be handled by the CI/CD pipeline and excluded via .gitignore.
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
| <title>ReproInventory</title> | ||
| <script type="module" crossorigin src="/ReproInventory/assets/index-BfAUm7qF.js"></script> | ||
| <script type="module" crossorigin src="/ReproInventory/assets/index-zwxElJ_Y.js"></script> |
There was a problem hiding this comment.
Build artifacts in the dist/ directory are being committed to the repository. Since the PR description mentions a new GitHub Actions workflow that builds the frontend automatically, these files should be generated during the CI/CD process and not tracked in version control. Tracking build artifacts can lead to unnecessary merge conflicts and repository bloat. It is recommended to add the dist/ directory to .gitignore.
| "course_length": [ | ||
| "1+ weeks" | ||
| ], |
There was a problem hiding this comment.
The course_length field for entry ID 60 is being changed to an array ["1+ weeks"], whereas other entries (like ID 58 and 59) use a string value. The frontend filtering logic in training-materials-browser.tsx expects a string for this field, so this inconsistency will likely break the filter for this entry.
"course_length": "1+ weeks",| "level": null, | ||
| "platform": null, | ||
| "keywords": null, |
There was a problem hiding this comment.
These lines introduce duplicate keys (level, platform, keywords) for entry ID 58. These keys are already defined with actual data later in the same object (starting at line 2199). While most JSON parsers will handle this by taking the last value, it is poor practice and makes the data file harder to maintain. These null assignments should be removed from the source YAML file and the JSON regenerated.
This pull request introduces a new workflow to automatically deploy and manage preview environments for pull requests, enhancing the review process by allowing reviewers to see live previews of frontend changes. Additionally, a minor update ensures that existing files are retained during deployment to the
gh-pagesbranch.PR Preview Workflow Automation:
.github/workflows/pr-preview.yml) that builds the frontend for each pull request, deploys it to a unique preview directory on thegh-pagesbranch, and posts a comment with the preview URL on the PR. The workflow also cleans up the preview when the PR is closed.Deployment Improvements:
.github/workflows/deploy.yml) to includekeep_files: truein the deploy step, ensuring that existing files on thegh-pagesbranch are preserved during deployments.