diff --git a/.github/helper-bot/index.js b/.github/helper-bot/index.js index 8f2501ee8..b9038a29d 100644 --- a/.github/helper-bot/index.js +++ b/.github/helper-bot/index.js @@ -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), {}) diff --git a/.github/workflows/test-automation-e2e.yml b/.github/workflows/test-automation-e2e.yml new file mode 100644 index 000000000..3e7a4e65b --- /dev/null +++ b/.github/workflows/test-automation-e2e.yml @@ -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 }} \ No newline at end of file diff --git a/.github/workflows/update-helper.yml b/.github/workflows/update-helper.yml index c945afc62..5ec588f00 100644 --- a/.github/workflows/update-helper.yml +++ b/.github/workflows/update-helper.yml @@ -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 * * *" @@ -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 }}