Skip to content

Commit a38d366

Browse files
committed
feat: incorporate determineSkips
1 parent ea110f6 commit a38d366

4 files changed

Lines changed: 90 additions & 12 deletions

File tree

dist/index.js

Lines changed: 70 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

find-python-projects.js

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ async function run() {
2424

2525
core.info(`Searching in "${rootDir}" ...`);
2626

27-
const output = await findPythonProjects(rootDir, desiredExportPaths);
27+
const skips = determineSkips(core.getInput("exclude-commands"));
28+
const output = await findPythonProjects(rootDir, desiredExportPaths, skips);
2829

2930
core.setOutput("projects", JSON.stringify(output.projects));
3031
core.setOutput(
@@ -40,8 +41,9 @@ async function run() {
4041
/**
4142
* @param {string} rootDir
4243
* @param {string[]?} desiredExportPaths
44+
* @param {Object<string, string>} skips
4345
*/
44-
async function findPythonProjects(rootDir, desiredExportPaths) {
46+
async function findPythonProjects(rootDir, desiredExportPaths, skips) {
4547
const globbyOpts = {
4648
gitignore: true,
4749
};
@@ -59,6 +61,7 @@ async function findPythonProjects(rootDir, desiredExportPaths) {
5961
const project = await createProjectResult(
6062
pyprojectPath,
6163
desiredExportPaths,
64+
skips,
6265
);
6366
projects.push(project);
6467
}
@@ -73,15 +76,26 @@ async function findPythonProjects(rootDir, desiredExportPaths) {
7376
/**
7477
* @param {string} pyprojectPath
7578
* @param {string[]?} desiredExportPaths
79+
* @param {Object<string, string>} skips
7680
*/
77-
async function createProjectResult(pyprojectPath, desiredExportPaths) {
81+
async function createProjectResult(pyprojectPath, desiredExportPaths, skips) {
7882
const projectToml = await fs.readFile(pyprojectPath);
7983
const projectTomlParsed = TOML.parse(projectToml);
8084

8185
const projectName = getBestConfig(projectTomlParsed, PROJECT_NAME_PATHS);
8286
const pythonVersion = getBestConfig(projectTomlParsed, PYTHON_VERSION_PATHS);
8387

8488
const commands = generateCommands(projectTomlParsed);
89+
const commandsFiltered = Object.fromEntries(
90+
Object.entries(commands).filter(([commandName]) => {
91+
const globalSkips = skips[GLOBAL_KEY] ?? [];
92+
const projectSkips = skips[projectName] ?? [];
93+
return (
94+
!globalSkips.includes(commandName) &&
95+
!projectSkips.includes(commandName)
96+
);
97+
}),
98+
);
8599

86100
const arbitraryMetadata = {};
87101
if (desiredExportPaths) {
@@ -92,7 +106,7 @@ async function createProjectResult(pyprojectPath, desiredExportPaths) {
92106

93107
return {
94108
buildBackend: getBuildBackend(projectTomlParsed),
95-
commands: commands,
109+
commands: commandsFiltered,
96110
directory: path.dirname(pyprojectPath),
97111
name: projectName,
98112
path: pyprojectPath,

find-python-projects.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ describe("find-python-projects", () => {
1111

1212
const inputsDefaults = {
1313
"additional-export-paths": "",
14+
skipCommands: "",
1415
};
1516
let inputs = {};
1617
let outputs = {};

0 commit comments

Comments
 (0)