mirror of
https://github.com/actions/setup-python
synced 2025-04-07 15:59:43 +00:00
Cache on ghes (#363)
* initial changes * updated version * format check * refactored code * updated test cases * Update src/utils.ts Co-authored-by: Brian Cristante <33549821+brcrista@users.noreply.github.com> * Update utils.ts * Update utils.test.ts * review comments * dist update * Review comment * update version * updated version Co-authored-by: Brian Cristante <33549821+brcrista@users.noreply.github.com>
This commit is contained in:
@ -4,16 +4,13 @@ import * as finderPyPy from './find-pypy';
|
||||
import * as path from 'path';
|
||||
import * as os from 'os';
|
||||
import {getCacheDistributor} from './cache-distributions/cache-factory';
|
||||
import {isGhes} from './utils';
|
||||
import {isCacheFeatureAvailable} from './utils';
|
||||
|
||||
function isPyPyVersion(versionSpec: string) {
|
||||
return versionSpec.startsWith('pypy-');
|
||||
}
|
||||
|
||||
async function cacheDependencies(cache: string, pythonVersion: string) {
|
||||
if (isGhes()) {
|
||||
throw new Error('Caching is not supported on GHES');
|
||||
}
|
||||
const cacheDependencyPath =
|
||||
core.getInput('cache-dependency-path') || undefined;
|
||||
const cacheDistributor = getCacheDistributor(
|
||||
@ -43,7 +40,7 @@ async function run() {
|
||||
}
|
||||
|
||||
const cache = core.getInput('cache');
|
||||
if (cache) {
|
||||
if (cache && isCacheFeatureAvailable()) {
|
||||
await cacheDependencies(cache, pythonVersion);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user