Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do not check releases for known versions #95

Merged
merged 1 commit into from
Oct 28, 2023
Merged
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
10 changes: 10 additions & 0 deletions __tests__/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,13 @@ test('checksum should match', async () => {
const isValid = await utils.validateCheckSum(filePath, validChecksum)
expect(isValid).toBeTruthy()
})

test('known checksum should be true', () => {
const isKnown = utils.isknownVersion('0.12.0')
expect(isKnown).toBeTruthy()
})

test('unknown checksum should be false', () => {
const isKnown = utils.isknownVersion('0.09.0')
expect(isKnown).toBeFalsy()
})
7 changes: 6 additions & 1 deletion dist/save-cache/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/save-cache/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/setup/37.index.js.map

Large diffs are not rendered by default.

11 changes: 10 additions & 1 deletion dist/setup/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/setup/index.js.map

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"devDependencies": {
"@types/node": "^20.8.9",
"@typescript-eslint/parser": "^5.62.0",
"@vercel/ncc": "^0.38.0",
"@vercel/ncc": "^0.38.1",
"eslint": "^8.52.0",
"eslint-plugin-github": "^4.10.1",
"eslint-plugin-jest": "^27.6.0",
Expand Down
7 changes: 6 additions & 1 deletion src/setup-rye.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import {
REPO,
KNOWN_CHECKSUMS,
validateCheckSum,
getArch
getArch,
isknownVersion
} from './utils'

async function run(): Promise<void> {
Expand Down Expand Up @@ -49,6 +50,10 @@ async function run(): Promise<void> {
}

async function resolveVersion(versionInput: string): Promise<string> {
if (isknownVersion(versionInput)) {
core.debug(`Version ${versionInput} is known.`)
return versionInput
}
const availableVersion = await getAvailableVersions()
if (!availableVersion.includes(versionInput)) {
if (versionInput === 'latest') {
Expand Down
5 changes: 5 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ export async function validateCheckSum(
})
}

export function isknownVersion(version: string): boolean {
const pattern = new RegExp(`^.*-.*-${version}$`)
return Object.keys(KNOWN_CHECKSUMS).some(key => pattern.test(key))
}

export function getArch(): Architecture | undefined {
const arch = process.arch
const archMapping: {[key: string]: Architecture} = {
Expand Down
Loading