Add support for custom PyPI repository configuration

- Add pypi-url, pypi-username, and pypi-password inputs to action.yml
- Implement configurePipRepository() function in utils.ts to create pip.conf/pip.ini
- Integrate pip configuration into setup-python.ts workflow
- Add comprehensive unit tests for pip configuration functionality
- Update README.md with usage examples and documentation
- Automatically mask credentials in logs for security

Fixes #814
This commit is contained in:
GitHub Copilot 2025-12-16 16:40:35 +00:00
parent 83679a892e
commit f054be5a92
5 changed files with 222 additions and 2 deletions

View file

@ -11,7 +11,8 @@ import {
logWarning,
IS_MAC,
getVersionInputFromFile,
getVersionsInputFromPlainFile
getVersionsInputFromPlainFile,
configurePipRepository
} from './utils';
import {exec} from '@actions/exec';
@ -159,6 +160,12 @@ async function run() {
if (cache && isCacheFeatureAvailable()) {
await cacheDependencies(cache, pythonVersion);
}
const pypiUrl = core.getInput('pypi-url');
if (pypiUrl) {
const pypiUsername = core.getInput('pypi-username');
const pypiPassword = core.getInput('pypi-password');
await configurePipRepository(pypiUrl, pypiUsername, pypiPassword);
}
const pipInstall = core.getInput('pip-install');
if (pipInstall) {
await installPipPackages(pipInstall);