Skip to content

WIP: Game Automation via Actions Workflow#362

Draft
j-mes wants to merge 2 commits intomainfrom
gaming-log-automation
Draft

WIP: Game Automation via Actions Workflow#362
j-mes wants to merge 2 commits intomainfrom
gaming-log-automation

Conversation

@j-mes
Copy link
Owner

@j-mes j-mes commented Jun 27, 2025

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 the progress.json file with new log entries, calculate deltas for hours, completion, and trackables, and ensure data integrity.

@j-mes j-mes requested a review from Copilot January 14, 2026 11:16
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 \
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
node scripts/update-progress.js \
node automation/update-progress.js \

Copilot uses AI. Check for mistakes.

const hours = parseFloat(hoursStr);
const completion = parseFloat(completionStr);
const date = new Date().toLocaleDateString("en-GB");
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
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("-");

Copilot uses AI. Check for mistakes.
Comment on lines +44 to +58
- 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 }}
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
- 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

Copilot uses AI. Check for mistakes.
const date = new Date().toLocaleDateString("en-GB");
const trackablesInput = trackablesRaw ? JSON.parse(trackablesRaw) : {};

const filePath = path.join(__dirname, "../_data/progress.json");
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
const filePath = path.join(__dirname, "../_data/progress.json");
const filePath = path.join(__dirname, "progress.json");

Copilot uses AI. Check for mistakes.
git config user.name "github-actions"
git config user.email "[email protected]"
git checkout -b update-${{ github.run_number }}
git add _data/progress.json
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
git add _data/progress.json
git add automation/progress.json

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants