Refactor Microsoft JDK installer to fetch version information from Microsoft #928
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
Microsoft JDK Distribution Refactoring
Summary
The Microsoft JDK installer has been refactored to fetch version information directly from the official Microsoft Learn documentation page instead of using a static JSON file stored in the repository.
Problems Solved
microsoft-openjdk-versions.json
) was outdated and didn't contain the latest Microsoft JDK releasesFiles Modified
1.
src/distributions/microsoft/installer.ts
Purpose: Core implementation of Microsoft JDK version fetching and installation
Changes:
getGitHubHttpHeaders
import (no longer needed)TypedResponse
import (no longer needed)getAvailableVersions()
method - now fetches from Microsoft Learn instead of GitHub APIparseVersionsFromHtml()
method - extracts versions from HTML using regexgenerateDownloadFiles()
method - dynamically creates download URLsBefore:
After:
Key Methods
getAvailableVersions()
parseVersionsFromHtml(html: string)
/OpenJDK\s+(\d+\.\d+\.\d+)(?:\s+LTS)?/gi
to find version numbersgenerateDownloadFiles(version: string, majorVersion: string)
2.
__tests__/distributors/microsoft-installer.test.ts
Purpose: Unit tests for Microsoft JDK installer
Changes:
data from '../data/microsoft.json'
importgetJson
methodget
method returning HTMLTest Version Updates:
3.
docs/advanced-usage.md
Purpose: User documentation for advanced usage scenarios
Changes:
token
input to increase rate limitslearn.microsoft.com
andaka.ms
instead ofgithub.com
)Before:
After:
4. Files Deleted
src/distributions/microsoft/microsoft-openjdk-versions.json
Benefits
Impact Analysis
Users
✅ No action required - Changes are transparent to users
✅ Better experience - Always get latest versions
✅ Fewer failures - No more rate limiting issues
Contributors
✅ Less maintenance - No need to update version JSON files
✅ Easier testing - Can test against live Microsoft releases
Operations
✅ Reduced GitHub API usage - No more API calls for version info
✅ Better reliability - Fetches from authoritative source
✅ Self-updating - New versions available immediately after Microsoft releases
Network Requirements Change
Before
api.github.com
- To fetch version informationaka.ms
- To download JDK binariesAfter
learn.microsoft.com
- To fetch version informationaka.ms
- To download JDK binariesBackward Compatibility
✅ 100% Compatible - Existing workflows continue to work unchanged
✅ Same API - No changes to action inputs or outputs
✅ Same behavior - Downloads and installs JDK the same way
✅ Better versions - Now includes latest releases that were missing before
Current Supported Versions (as of Oct 2025)
Based on the refactored implementation, the following versions are automatically detected:
Download URL Pattern
The download URLs follow Microsoft's standard pattern:
Where:
{version}
: Version number (e.g., 21.0.8){os}
: Operating system (linux, macos, windows){arch}
: Architecture (x64, aarch64){ext}
: File extension (tar.gz, zip)Example URLs
Testing
Running Tests
npm test -- microsoft-installer.test.ts
Testing Checklist
Rollback Plan (If Needed)
If issues are discovered, rollback requires:
installer.ts
getAvailableVersions()
methodmicrosoft-openjdk-versions.json
file with updated versionsNote: The old JSON file has been deleted. If needed, it can be retrieved from git history (commit before this refactoring).
Success Metrics
References
Related issue:

#645
Check list: