Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ jobs:
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./frontend/dist
publish_branch: gh-pages
publish_branch: gh-pages
keep_files: true
102 changes: 102 additions & 0 deletions .github/workflows/pr-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: PR Preview

on:
pull_request:
types: [opened, synchronize, reopened, closed]

permissions:
contents: write
pull-requests: write

jobs:
deploy-preview:
if: github.event.action != 'closed'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install dependencies
working-directory: ./frontend
run: npm install

- name: Build with PR base path
working-directory: ./frontend
run: npm run build -- --base=/ReproInventory/pr-previews/pr-${{ github.event.pull_request.number }}/

- name: Deploy preview
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./frontend/dist
publish_branch: gh-pages
destination_dir: pr-previews/pr-${{ github.event.pull_request.number }}
keep_files: true

- name: Post preview URL comment
uses: actions/github-script@v7
with:
script: |
const prNumber = context.payload.pull_request.number;
const previewUrl = `https://${{ github.repository_owner }}.github.io/ReproInventory/pr-previews/pr-${prNumber}/`;
const body = [
'## 🔍 PR Preview',
'',
`**Preview URL:** ${previewUrl}`,
'',
`_Last updated: ${new Date().toUTCString()}_`,
].join('\n');

const comments = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
});

const existing = comments.data.find(
c => c.user.type === 'Bot' && c.body.includes('## 🔍 PR Preview')
);

if (existing) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: existing.id,
body,
});
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body,
});
}

cleanup-preview:
if: github.event.action == 'closed'
runs-on: ubuntu-latest
steps:
- name: Checkout gh-pages branch
uses: actions/checkout@v4
with:
ref: gh-pages

- name: Remove preview directory
run: |
PR_DIR="pr-previews/pr-${{ github.event.pull_request.number }}"
if [ -d "$PR_DIR" ]; then
rm -rf "$PR_DIR"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add -A
git commit -m "chore: remove PR preview for #${{ github.event.pull_request.number }}"
git push
else
echo "No preview directory found, nothing to clean up."
fi

Large diffs are not rendered by default.

13 changes: 8 additions & 5 deletions frontend/dist/data/reproinventory_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -2185,7 +2185,10 @@
],
"course_name": "Andy's brain book",
"url": "https://andysbrainbook.readthedocs.io/en/latest/",
"course_length": "NA",
"course_length": "1+ weeks",
"level": null,
"platform": null,
"keywords": null,
Comment on lines +2189 to +2191
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

"instruction_medium": [
"blog post",
"Hands-on tutorial / notebooks"
Expand Down Expand Up @@ -2265,7 +2268,7 @@
"large-scale data",
"open data"
],
"course_length": "NA",
"course_length": "1+ weeks",
"instruction_medium": null,
"delivery": null,
"language": null,
Expand Down Expand Up @@ -2320,7 +2323,9 @@
"keywords": [
"Machine Learning"
],
"course_length": "NA",
"course_length": [
"1+ weeks"
],
Comment on lines +2326 to +2328
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

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",

"instruction_medium": null,
"delivery": null,
"language": null,
Expand Down Expand Up @@ -2373,8 +2378,6 @@
"Best Practices",
"Data Visualization"
],
"course_length": null,
"instruction_medium": null,
"delivery": null,
"language": [
"English"
Expand Down
2 changes: 1 addition & 1 deletion frontend/dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<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>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

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.

<link rel="stylesheet" crossorigin href="/ReproInventory/assets/index-D0VB5yOL.css">
</head>
<body>
Expand Down
Loading