Skip to content

ci(workflows): ✨ added Minecraft screenshot example workflow#810

Open
Copilot wants to merge 7 commits intomainfrom
copilot/add-github-actions-workflow
Open

ci(workflows): ✨ added Minecraft screenshot example workflow#810
Copilot wants to merge 7 commits intomainfrom
copilot/add-github-actions-workflow

Conversation

Copy link
Contributor

Copilot AI commented Mar 7, 2026

  • Created .github/workflows/minecraft-screenshot.yaml that triggers on workflow_dispatch and pull_request
  • Installs XFCE, Xvfb, scrot, and tesseract-ocr as system dependencies (Java managed by portablemc itself)
  • Installs Rust toolchain and portablemc-cli via cargo (with caching via actions/cache@v5)
  • Starts virtual framebuffer (Xvfb) and XFCE window manager
  • Fixed xfwm4 --daemon (unsupported flag) — now uses xfwm4 &
  • Launches latest stable Minecraft via start -- release (portablemc installs required JRE itself)
  • Saves Minecraft process PID via $! and verifies it is still alive before taking screenshot
  • Waits 30 seconds for game initialisation before capturing screenshot
  • Runs tesseract OCR on the screenshot and prints recognised text to the workflow log
  • Uploads screenshot PNG and OCR text file as workflow artifacts via actions/upload-artifact@v7
  • permissions: {} for least-privilege security
Original prompt

Create example github actions workflow that installs cargo install portablemc-cli, virtual desktop like xfce and runs latest vanilla minecraft with portablemc-cli, make screenshot 10 seconds after game start. Runs on dispatch.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: caunt <5324218+caunt@users.noreply.github.com>
Copilot AI changed the title [WIP] Add GitHub Actions workflow for Minecraft setup ci(workflows): ✨ added Minecraft screenshot example workflow Mar 7, 2026
Copilot finished work on behalf of caunt March 7, 2026 06:52
@caunt
Copy link
Owner

caunt commented Mar 7, 2026

@copilot add "on pull_request:" temporary trigger

@caunt caunt marked this pull request as ready for review March 7, 2026 12:29
…orkflow

Co-authored-by: caunt <5324218+caunt@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 7, 2026

@copilot add "on pull_request:" temporary trigger

Added pull_request: trigger in commit 0f61b89.

Copy link
Contributor

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 adds a new GitHub Actions example workflow (.github/workflows/minecraft-screenshot.yaml) that boots a vanilla Minecraft instance inside a headless virtual desktop (Xvfb + xfwm4) on an ubuntu-latest runner, waits 10 seconds, captures a screenshot with scrot, and uploads it as an artifact. The launcher is portablemc-cli, installed via cargo install with a cargo registry cache.

Changes:

  • New workflow file that installs system dependencies (xfce4, xvfb, scrot, openjdk-21), Rust, and portablemc-cli.
  • Launches Minecraft in a virtual display and captures a screenshot after a fixed sleep.
  • Uploads the screenshot PNG as a workflow artifact.

…king

Replace unsupported --daemon flag on xfwm4 with background (&) execution.
Capture Minecraft process PID via $! and verify it is still alive before
taking the screenshot, failing the workflow if the process has exited.

Co-authored-by: caunt <5324218+caunt@users.noreply.github.com>
Copilot finished work on behalf of caunt March 7, 2026 12:49
@caunt
Copy link
Owner

caunt commented Mar 7, 2026

@copilot Run portablemc --main-dir "$HOME/.portablemc" start --jvm "$(which java)" -- latest &

158.5 kB/s 100.0% (0/1)
329.3 kB/s 100.0% (0/1)
668.5 kB/s 100.0% (0/1)
1.0 MB/s 100.0% (0/1)
1.3 MB/s 100.0% (0/1)
1.7 MB/s 100.0% (0/1)
2.0 MB/s 100.0% (0/1)
2.3 MB/s 100.0% (0/1)
2.7 MB/s 100.0% (0/1)
3.0 MB/s 100.0% (0/1)
3.3 MB/s 100.0% (0/1)
3.6 MB/s 100.0% (0/1)
4.0 MB/s 100.0% (0/1)
4.3 MB/s 100.0% (0/1)
4.6 MB/s 100.0% (0/1)
4.9 MB/s 100.0% (0/1)
5.2 MB/s 100.0% (0/1)
5.3 MB/s 100.0% (0/1)
5.2 MB/s 262 kB (1)
[ .. ] Loading version latest -- 5.2 MB/s 262 kB (1)
[ ERRO ] Version latest not found -- 5.2 MB/s 262 kB (1)

Should be not "latest" but "release"

Also do not install java and do not pass it to portablemc. It will install required java itself.

…va install

Changed version alias from "latest" to "release" so portablemc resolves
the latest stable Minecraft release correctly. Removed openjdk-21-jre-headless
from system dependencies and dropped the --jvm flag since portablemc
downloads and manages its own JRE automatically.

Co-authored-by: caunt <5324218+caunt@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 7, 2026

@copilot Run portablemc --main-dir "$HOME/.portablemc" start --jvm "$(which java)" -- latest &

158.5 kB/s 100.0% (0/1)...

Fixed in commit 7e5895c:

  • Version alias changed from latest to release.
  • Removed openjdk-21-jre-headless from the apt install list and dropped --jvm "$(which java)" — portablemc will download and manage its own JRE.

Copilot finished work on behalf of caunt March 7, 2026 13:00
@caunt
Copy link
Owner

caunt commented Mar 7, 2026

@copilot update all actions to latest major tag version. Increase the wait timer to 30.

…ed wait timer

Updated actions/cache from v4 to v5, actions/upload-artifact from v4 to v7.
Increased the game initialisation wait from 10s to 30s to give Minecraft
more time to download assets and reach the main menu on first run.

Co-authored-by: caunt <5324218+caunt@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 7, 2026

@copilot update all actions to latest major tag version. Increase the wait timer to 30.

Done in commit 4eda675: bumped actions/cache to v5, actions/upload-artifact to v7, and changed the wait timer from 10s to 30s.

Copilot finished work on behalf of caunt March 7, 2026 13:07
@caunt
Copy link
Owner

caunt commented Mar 7, 2026

@copilot also install tesseract and do OCR before screenshot

Added tesseract-ocr to apt dependencies and a new "OCR screenshot" step
that runs tesseract on the captured PNG, prints the recognised text to the
workflow log, and uploads the .txt alongside the image as an artifact.

Co-authored-by: caunt <5324218+caunt@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 7, 2026

@copilot also install tesseract and do OCR before screenshot

Done in commit 82720f4: added tesseract-ocr to the apt install list and a new "OCR screenshot" step that runs tesseract on the captured PNG, echoes the recognised text to the workflow log, and includes the .txt output file alongside the image in the uploaded artifact.

Copilot finished work on behalf of caunt March 7, 2026 13:23
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.

3 participants