Compare commits

...

4 Commits

Author SHA1 Message Date
Mark Ferguson
ef65e0477e
Merge e39e9e1fa0 into 8df1039502 2024-10-23 14:00:32 +05:30
John Wesley Walker III
8df1039502
Refine isGhes logic (#697) 2024-10-21 19:57:52 +02:00
mahabaleshwars
870c199c48
Update workflows for GraalVM and Version Enhancements (#699)
* workflow update graalvm version

* updated workflow for publish action version update
2024-10-21 11:43:20 -05:00
Mark Ferguson
e39e9e1fa0 chore: add Dependabot configuration for npm and GitHub Actions 2024-10-02 15:20:08 +01:00
7 changed files with 80 additions and 6 deletions

21
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,21 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: 'weekly'
day: 'monday'
target-branch: 'main'
open-pull-requests-limit: 10
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: 'weekly'
day: 'monday'
target-branch: 'main'
open-pull-requests-limit: 10

View File

@ -51,7 +51,7 @@ jobs:
version: 21
- distribution: graalvm
os: macos-latest
version: 17
version: 17.0.12
- distribution: graalvm
os: windows-latest
version: 21

View File

@ -23,7 +23,7 @@ jobs:
steps:
- name: Update the ${{ env.TAG_NAME }} tag
id: update-major-tag
uses: actions/publish-action@v0.2.2
uses: actions/publish-action@v0.3.0
with:
source-tag: ${{ env.TAG_NAME }}
slack-webhook: ${{ secrets.SLACK_WEBHOOK }}

View File

@ -3,7 +3,8 @@ import * as core from '@actions/core';
import {
convertVersionToSemver,
isVersionSatisfies,
isCacheFeatureAvailable
isCacheFeatureAvailable,
isGhes
} from '../src/util';
jest.mock('@actions/cache');
@ -80,3 +81,41 @@ describe('convertVersionToSemver', () => {
expect(actual).toBe(expected);
});
});
describe('isGhes', () => {
const pristineEnv = process.env;
beforeEach(() => {
jest.resetModules();
process.env = {...pristineEnv};
});
afterAll(() => {
process.env = pristineEnv;
});
it('returns false when the GITHUB_SERVER_URL environment variable is not defined', async () => {
delete process.env['GITHUB_SERVER_URL'];
expect(isGhes()).toBeFalsy();
});
it('returns false when the GITHUB_SERVER_URL environment variable is set to github.com', async () => {
process.env['GITHUB_SERVER_URL'] = 'https://github.com';
expect(isGhes()).toBeFalsy();
});
it('returns false when the GITHUB_SERVER_URL environment variable is set to a GitHub Enterprise Cloud-style URL', async () => {
process.env['GITHUB_SERVER_URL'] = 'https://contoso.ghe.com';
expect(isGhes()).toBeFalsy();
});
it('returns false when the GITHUB_SERVER_URL environment variable has a .localhost suffix', async () => {
process.env['GITHUB_SERVER_URL'] = 'https://mock-github.localhost';
expect(isGhes()).toBeFalsy();
});
it('returns true when the GITHUB_SERVER_URL environment variable is set to some other URL', async () => {
process.env['GITHUB_SERVER_URL'] = 'https://src.onpremise.fabrikam.com';
expect(isGhes()).toBeTruthy();
});
});

View File

@ -88552,7 +88552,11 @@ function isJobStatusSuccess() {
exports.isJobStatusSuccess = isJobStatusSuccess;
function isGhes() {
const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com');
return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
const hostname = ghUrl.hostname.trimEnd().toUpperCase();
const isGitHubHost = hostname === 'GITHUB.COM';
const isGitHubEnterpriseCloudHost = hostname.endsWith('.GHE.COM');
const isLocalHost = hostname.endsWith('.LOCALHOST');
return !isGitHubHost && !isGitHubEnterpriseCloudHost && !isLocalHost;
}
exports.isGhes = isGhes;
function isCacheFeatureAvailable() {

6
dist/setup/index.js vendored
View File

@ -126328,7 +126328,11 @@ function isJobStatusSuccess() {
exports.isJobStatusSuccess = isJobStatusSuccess;
function isGhes() {
const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com');
return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
const hostname = ghUrl.hostname.trimEnd().toUpperCase();
const isGitHubHost = hostname === 'GITHUB.COM';
const isGitHubEnterpriseCloudHost = hostname.endsWith('.GHE.COM');
const isLocalHost = hostname.endsWith('.LOCALHOST');
return !isGitHubHost && !isGitHubEnterpriseCloudHost && !isLocalHost;
}
exports.isGhes = isGhes;
function isCacheFeatureAvailable() {

View File

@ -92,7 +92,13 @@ export function isGhes(): boolean {
const ghUrl = new URL(
process.env['GITHUB_SERVER_URL'] || 'https://github.com'
);
return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
const hostname = ghUrl.hostname.trimEnd().toUpperCase();
const isGitHubHost = hostname === 'GITHUB.COM';
const isGitHubEnterpriseCloudHost = hostname.endsWith('.GHE.COM');
const isLocalHost = hostname.endsWith('.LOCALHOST');
return !isGitHubHost && !isGitHubEnterpriseCloudHost && !isLocalHost;
}
export function isCacheFeatureAvailable(): boolean {