Conversation
There was a problem hiding this comment.
Pull request overview
This PR implements a game progress tracking system with automation capabilities. It introduces a JSON-based data structure to store game progress, a React component to visualize the data, and a GitHub Actions workflow to automate updates via manual dispatch.
Changes:
- Created a React component to display game progress sorted by most recent update
- Defined a JSON structure storing game progress with logs, trackables, and metadata
- Implemented a GitHub Actions workflow for automated game log updates with PR creation
- Added a Node.js script to handle progress.json updates with delta calculations
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| automation/game-progress.tsx | React component displaying game progress with sorting and delta visualization |
| automation/progress.json | JSON data structure containing initial game progress data for six games |
| automation/update-gamelog.yml | GitHub Actions workflow automating game log updates via manual dispatch |
| automation/update-progress.js | Node.js script handling progress.json updates and delta calculations |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| - name: Run update script | ||
| run: | | ||
| node scripts/update-progress.js \ |
There was a problem hiding this comment.
The script path is incorrect. The file is located at automation/update-progress.js but the workflow references scripts/update-progress.js. This will cause the workflow to fail when executed.
| node scripts/update-progress.js \ | |
| node automation/update-progress.js \ |
|
|
||
| const hours = parseFloat(hoursStr); | ||
| const completion = parseFloat(completionStr); | ||
| const date = new Date().toLocaleDateString("en-GB"); |
There was a problem hiding this comment.
The date format used here (dd/mm/yyyy via en-GB locale) is inconsistent with ISO 8601 standards and may cause issues with date parsing and sorting. Consider using an ISO format (yyyy-mm-dd) for better international compatibility and programmatic handling.
| const date = new Date().toLocaleDateString("en-GB"); | |
| const now = new Date(); | |
| const date = [ | |
| now.getFullYear(), | |
| String(now.getMonth() + 1).padStart(2, "0"), | |
| String(now.getDate()).padStart(2, "0") | |
| ].join("-"); |
| - name: Commit changes | ||
| run: | | ||
| git config user.name "github-actions" | ||
| git config user.email "[email protected]" | ||
| git checkout -b update-${{ github.run_number }} | ||
| git add _data/progress.json | ||
| git commit -m "Game log: ${{ github.event.inputs.game }} by ${{ github.actor }}" | ||
| git push origin update-${{ github.run_number }} | ||
|
|
||
| - name: Create pull request | ||
| id: cpr | ||
| uses: peter-evans/create-pull-request@v6 | ||
| with: | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| branch: update-${{ github.run_number }} |
There was a problem hiding this comment.
The workflow manually creates a branch, commits, and pushes changes before using the create-pull-request action. The peter-evans/create-pull-request action is designed to handle all of this automatically. The manual git operations (lines 44-51) should be removed as they are redundant and may conflict with the action's behavior.
| - name: Commit changes | |
| run: | | |
| git config user.name "github-actions" | |
| git config user.email "[email protected]" | |
| git checkout -b update-${{ github.run_number }} | |
| git add _data/progress.json | |
| git commit -m "Game log: ${{ github.event.inputs.game }} by ${{ github.actor }}" | |
| git push origin update-${{ github.run_number }} | |
| - name: Create pull request | |
| id: cpr | |
| uses: peter-evans/create-pull-request@v6 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| branch: update-${{ github.run_number }} | |
| - name: Create pull request | |
| id: cpr | |
| uses: peter-evans/create-pull-request@v6 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| branch: update-${{ github.run_number }} | |
| commit-message: "Game log: ${{ github.event.inputs.game }} by ${{ github.actor }}" | |
| add-paths: | | |
| _data/progress.json |
| const date = new Date().toLocaleDateString("en-GB"); | ||
| const trackablesInput = trackablesRaw ? JSON.parse(trackablesRaw) : {}; | ||
|
|
||
| const filePath = path.join(__dirname, "../_data/progress.json"); |
There was a problem hiding this comment.
The file path references _data/progress.json but the actual file is located at automation/progress.json. This path mismatch will cause the script to fail when attempting to read or write the progress data.
| const filePath = path.join(__dirname, "../_data/progress.json"); | |
| const filePath = path.join(__dirname, "progress.json"); |
| git config user.name "github-actions" | ||
| git config user.email "[email protected]" | ||
| git checkout -b update-${{ github.run_number }} | ||
| git add _data/progress.json |
There was a problem hiding this comment.
The git add command references _data/progress.json but the actual file location is automation/progress.json. This inconsistency will cause the commit to fail or commit the wrong file.
| git add _data/progress.json | |
| git add automation/progress.json |
This pull request introduces a comprehensive game progress tracking system, including a React-based UI, a JSON data structure for storing game progress, and automation scripts for updating logs via GitHub Actions. The key changes focus on implementing the tracking functionality, creating an update workflow, and ensuring seamless integration with version control.
Frontend Implementation:
automation/game-progress.tsx: Added a React component to display game progress, including logs with hours played, completion percentage, and trackable items. Sorting functionality ensures games are displayed by the most recently updated.Data Structure:
automation/progress.json: Defined a JSON structure to store game progress data, including start dates, logs, and trackable items for multiple games.Automation Workflow:
automation/update-gamelog.yml: Created a GitHub Actions workflow to update game logs. This includes inputs for game title, hours played, completion percentage, and trackables, and automates pull request creation and merging.Backend Script:
automation/update-progress.js: Implemented a Node.js script to update theprogress.jsonfile with new log entries, calculate deltas for hours, completion, and trackables, and ensure data integrity.