github token accept through environment variable

This commit is contained in:
mahabaleshwars 2025-07-03 14:58:30 +05:30
parent 6992528a74
commit 4c9e711992
5 changed files with 7 additions and 12 deletions

View File

@ -18,11 +18,6 @@ The `setup-java` action provides the following functionality for GitHub Actions
This action allows you to work with Java and Scala projects. This action allows you to work with Java and Scala projects.
## V2 vs V1
- V2 supports custom distributions and provides support for Azul Zulu OpenJDK, Eclipse Temurin and AdoptOpenJDK out of the box. V1 supports only Azul Zulu OpenJDK.
- V2 requires you to specify distribution along with the version. V1 defaults to Azul Zulu OpenJDK, only version input is required. Follow [the migration guide](docs/switching-to-v2.md) to switch from V1 to V2.
## Usage ## Usage
- `java-version`: The Java version that is going to be set up. Takes a whole or [semver](#supported-version-syntax) Java version. If not specified, the action will expect `java-version-file` input to be specified. - `java-version`: The Java version that is going to be set up. Takes a whole or [semver](#supported-version-syntax) Java version. If not specified, the action will expect `java-version-file` input to be specified.

View File

@ -114,7 +114,7 @@ describe('GraalVMDistribution', () => {
const osType = distribution.getPlatform(); const osType = distribution.getPlatform();
if (osType === 'windows' && distroArch === 'aarch64') { if (osType === 'windows' && distroArch === 'aarch64') {
return; // skip, aarch64 is not available for Windows test.skip('Skipping test: aarch64 is not available for Windows');
} }
const archiveType = getDownloadArchiveExtension(); const archiveType = getDownloadArchiveExtension();

View File

@ -93676,8 +93676,8 @@ function convertVersionToSemver(version) {
return mainVersion; return mainVersion;
} }
exports.convertVersionToSemver = convertVersionToSemver; exports.convertVersionToSemver = convertVersionToSemver;
function getGitHubHttpHeaders(token) { function getGitHubHttpHeaders() {
const resolvedToken = token || core.getInput('token'); const resolvedToken = process.env.GITHUB_TOKEN || core.getInput('token');
const auth = !resolvedToken ? undefined : `token ${resolvedToken}`; const auth = !resolvedToken ? undefined : `token ${resolvedToken}`;
const headers = { const headers = {
accept: 'application/vnd.github.VERSION.raw' accept: 'application/vnd.github.VERSION.raw'

4
dist/setup/index.js vendored
View File

@ -131671,8 +131671,8 @@ function convertVersionToSemver(version) {
return mainVersion; return mainVersion;
} }
exports.convertVersionToSemver = convertVersionToSemver; exports.convertVersionToSemver = convertVersionToSemver;
function getGitHubHttpHeaders(token) { function getGitHubHttpHeaders() {
const resolvedToken = token || core.getInput('token'); const resolvedToken = process.env.GITHUB_TOKEN || core.getInput('token');
const auth = !resolvedToken ? undefined : `token ${resolvedToken}`; const auth = !resolvedToken ? undefined : `token ${resolvedToken}`;
const headers = { const headers = {
accept: 'application/vnd.github.VERSION.raw' accept: 'application/vnd.github.VERSION.raw'

View File

@ -183,8 +183,8 @@ export function convertVersionToSemver(version: number[] | string) {
return mainVersion; return mainVersion;
} }
export function getGitHubHttpHeaders(token?: string): OutgoingHttpHeaders { export function getGitHubHttpHeaders(): OutgoingHttpHeaders {
const resolvedToken = token || core.getInput('token'); const resolvedToken = process.env.GITHUB_TOKEN || core.getInput('token');
const auth = !resolvedToken ? undefined : `token ${resolvedToken}`; const auth = !resolvedToken ? undefined : `token ${resolvedToken}`;
const headers: OutgoingHttpHeaders = { const headers: OutgoingHttpHeaders = {