Skip to content
Open
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
49 changes: 49 additions & 0 deletions .github/helper-bot/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,56 @@ const supportedVersions = {
bedrock: require('../../data/bedrock/common/versions.json')
}

async function handleTestVersion(testVersion, mockVersionData) {
console.log(`🧪 Processing test version: ${testVersion}`)
const title = `[TEST] Support Minecraft PC ${testVersion}`
const issueStatus = await github.findIssue({ titleIncludes: title, author: null }) || {}

if (!issueStatus?.isOpen) {
// Create test issue
console.log('Creating test issue...')
const issuePayload = buildFirstIssue(title, mockVersionData, { protocol_version: 999, name: testVersion })
const issue = await github.createIssue(issuePayload)
console.log(`Created test issue: ${issue.url}`)

// Create test PR
console.log('Creating test PR...')
try {
const pr = await createInitialPull('pc', issue.url, { version: testVersion, protocolVersion: 999 })
console.log(`Created test PR: ${pr.url}`)

// Trigger minecraft-data-generator
console.log('Triggering minecraft-data-generator...')
await github.triggerWorkflow('PrismarineJS/minecraft-data-generator', 'handle-mcdata-update.yml', {
version: testVersion,
pr_number: pr.number.toString(),
issue_number: issue.number.toString()
})
console.log('✅ Test automation chain initiated!')
} catch (e) {
console.error('Failed to create test PR or trigger generator:', e)
}
} else {
console.log('Test issue already exists, skipping...')
}
}

async function updateManifestPC () {
// Check for test version injection
const testVersion = process.env.TEST_VERSION
if (testVersion) {
console.log(`🧪 TEST MODE: Injecting test version ${testVersion}`)
// Create mock version data for testing
const mockVersionData = {
id: testVersion,
type: 'release',
releaseTime: new Date().toISOString(),
time: new Date().toISOString(),
url: 'https://example.com/test.jar'
}
return await handleTestVersion(testVersion, mockVersionData)
}

const manifest = await fetch(pcManifestURL).then(res => res.json())
// fs.writeFileSync('./manifest.json', JSON.stringify(manifest, null, 2))
const knownVersions = protocolVersions.pc.reduce((acc, cur) => (acc[cur.minecraftVersion] = cur, acc), {})
Expand Down
49 changes: 49 additions & 0 deletions .github/workflows/test-automation-e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Test Automation Chain

on:
workflow_dispatch:
inputs:
test_version:
description: 'Test version (e.g., 1.99.99-test)'
required: false
default: ''
type: string

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Generate test version
id: version
run: |
if [ -n "${{ github.event.inputs.test_version }}" ]; then
TEST_VERSION="${{ github.event.inputs.test_version }}"
else
TIMESTAMP=$(date +"%Y%m%d-%H%M%S")
TEST_VERSION="1.99.99-test-${TIMESTAMP}"
fi
echo "version=${TEST_VERSION}" >> $GITHUB_OUTPUT
echo "🧪 Testing automation chain with: ${TEST_VERSION}"

- name: Trigger update helper (simulates new version detection)
run: |
echo "🚀 Triggering update-helper to simulate new version detection"
echo "Test version: ${{ steps.version.outputs.version }}"
gh workflow run update-helper.yml -f test_version="${{ steps.version.outputs.version }}"

echo "✅ Update helper triggered!"
echo ""
echo "This simulates the natural flow when a new Minecraft version is released:"
echo "1. 🔍 update-helper detects 'new version'"
echo "2. 🏭 minecraft-data-generator gets triggered"
echo "3. 📊 minecraft-data processes generated data"
echo "4. 🔗 node-minecraft-protocol gets triggered"
echo "5. 🤖 mineflayer gets triggered"
echo ""
echo "🔍 Check for PRs in all repos in 10-15 minutes:"
echo "- https://github.com/PrismarineJS/minecraft-data/pulls"
echo "- https://github.com/PrismarineJS/node-minecraft-protocol/pulls"
echo "- https://github.com/PrismarineJS/mineflayer/pulls"
echo "- https://github.com/PrismarineJS/minecraft-data-generator/pulls"
env:
GITHUB_TOKEN: ${{ secrets.PAT_PASSWORD }}
9 changes: 8 additions & 1 deletion .github/workflows/update-helper.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: Update Helper
on:
workflow_dispatch:
inputs:
test_version:
description: 'Test version to inject (for testing only)'
required: false
default: ''
type: string
schedule:
- cron: "0 */2 * * *"

Expand All @@ -23,4 +29,5 @@ jobs:
run: node index.js
working-directory: .github/helper-bot
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.PAT_PASSWORD }}
TEST_VERSION: ${{ github.event.inputs.test_version }}