MCPcopy Index your code
hub / github.com/actions/setup-python / getVersionsInputFromPlainFile

Function getVersionsInputFromPlainFile

src/utils.ts:301–317  ·  view source on GitHub ↗
(versionFile: string)

Source from the content-addressed store, hash-verified

299 * - Trims whitespace.
300 */
301export function getVersionsInputFromPlainFile(versionFile: string): string[] {
302 core.debug(`Trying to resolve versions from ${versionFile}`);
303 const content = fs.readFileSync(versionFile, 'utf8').trim();
304 const lines = content.split(/\r\n|\r|\n/);
305 const versions = lines
306 .map(line => {
307 if (line.startsWith('#') || line.trim() === '') {
308 return undefined;
309 }
310 let version: string = line.trim();
311 version = version.split('/')[0];
312 return version;
313 })
314 .filter(version => version !== undefined) as string[];
315 core.info(`Resolved ${versionFile} as ${versions.join(', ')}`);
316 return versions;
317}
318
319/**
320 * Python version extracted from a .tool-versions file.

Callers 1

getVersionInputFromFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected