Skip to content
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
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ This action aims to help you eliminate (or at least reduce) the amount of custom
- **root-dir**: Directory root for where to begin recursively searching for projects.
Python projects contained in this directory or lower will be discovered. Defaults to your repository's root directory.

- **additional-export-paths**: Additional TOML keys to export as part of the projects object. Specify them as json path strings, separated by commas. For example, "tool.foo.bar,baz.qux".

## Outputs
- **paths**: JSON array of found project path strings
Expand Down Expand Up @@ -39,6 +40,8 @@ These are the fields for `project` objects in the output:
- **commands**: Object with keys for each discovered command and the shell command as the value.
This is dynamically constructed from the `pyproject.toml` content.

- **exports**: Object with keys specified by the `additional-export-paths` input, and the structured TOML data (parsed as JSON) as the values.


## Project Commands
In the absence of Python standards for expressing internal project CI/CD/Dev operations, this action tries to unify the various known ways in the wild.
Expand Down Expand Up @@ -79,4 +82,4 @@ https://stackoverflow.com/questions/70386944/how-should-poetry-scripts-used-in-t
https://github.com/python-poetry/poetry/issues/3386

## Example Workflow
[.github/workflows/examples/example.yml](.github/workflows/examples/example.yml)
[.github/workflows/examples/example.yml](.github/workflows/examples/example.yml)
62 changes: 62 additions & 0 deletions __snapshots__/find-python-projects.test.js.snap
Original file line number Diff line number Diff line change
@@ -1,5 +1,53 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`find-python-projects Exports keys as instructed 1`] = `
{
"paths": [
"test-fixtures/project-with-exports/pyproject.toml",
],
"projects": [
{
"buildBackend": "poetry.core.masonry.api",
"commands": {
"install": "poetry install",
},
"directory": "test-fixtures/project-with-exports",
"exports": {
"tool.export.me.please": {
"foo": "bar",
"one": 1,
"true": true,
},
},
"name": "single-project",
"path": "test-fixtures/project-with-exports/pyproject.toml",
"pythonVersion": "^3.9",
},
],
"projects-by-command": {
"install": [
{
"buildBackend": "poetry.core.masonry.api",
"commands": {
"install": "poetry install",
},
"directory": "test-fixtures/project-with-exports",
"exports": {
"tool.export.me.please": {
"foo": "bar",
"one": 1,
"true": true,
},
},
"name": "single-project",
"path": "test-fixtures/project-with-exports/pyproject.toml",
"pythonVersion": "^3.9",
},
],
},
}
`;

exports[`find-python-projects finds projects 1`] = `
{
"paths": [
Expand All @@ -16,6 +64,7 @@ exports[`find-python-projects finds projects 1`] = `
"install": "poetry install",
},
"directory": "test-fixtures/multi-project/project-1",
"exports": {},
"name": "sub-project-1",
"path": "test-fixtures/multi-project/project-1/pyproject.toml",
"pythonVersion": "^3.9",
Expand All @@ -29,6 +78,7 @@ exports[`find-python-projects finds projects 1`] = `
"test": "poetry run pytest",
},
"directory": "test-fixtures/multi-project/project-2",
"exports": {},
"name": "sub-project-2",
"path": "test-fixtures/multi-project/project-2/pyproject.toml",
"pythonVersion": "^3.9",
Expand All @@ -38,6 +88,7 @@ exports[`find-python-projects finds projects 1`] = `
"install": null,
},
"directory": "test-fixtures/multi-project/project-4",
"exports": {},
"name": "sub-project-4",
"path": "test-fixtures/multi-project/project-4/pyproject.toml",
"pythonVersion": "^3.9",
Expand All @@ -49,6 +100,7 @@ exports[`find-python-projects finds projects 1`] = `
"test": "pdm run test",
},
"directory": "test-fixtures/multi-project/project-5",
"exports": {},
"name": "project-5",
"path": "test-fixtures/multi-project/project-5/pyproject.toml",
"pythonVersion": "==3.12.*",
Expand All @@ -60,6 +112,7 @@ exports[`find-python-projects finds projects 1`] = `
"test": "poe test",
},
"directory": "test-fixtures/multi-project/project-6",
"exports": {},
"name": "sub-project-6",
"path": "test-fixtures/multi-project/project-6/pyproject.toml",
"pythonVersion": "^3.9",
Expand All @@ -73,6 +126,7 @@ exports[`find-python-projects finds projects 1`] = `
"install": "poetry install",
},
"directory": "test-fixtures/multi-project/project-1",
"exports": {},
"name": "sub-project-1",
"path": "test-fixtures/multi-project/project-1/pyproject.toml",
"pythonVersion": "^3.9",
Expand All @@ -86,6 +140,7 @@ exports[`find-python-projects finds projects 1`] = `
"test": "poetry run pytest",
},
"directory": "test-fixtures/multi-project/project-2",
"exports": {},
"name": "sub-project-2",
"path": "test-fixtures/multi-project/project-2/pyproject.toml",
"pythonVersion": "^3.9",
Expand All @@ -97,6 +152,7 @@ exports[`find-python-projects finds projects 1`] = `
"test": "pdm run test",
},
"directory": "test-fixtures/multi-project/project-5",
"exports": {},
"name": "project-5",
"path": "test-fixtures/multi-project/project-5/pyproject.toml",
"pythonVersion": "==3.12.*",
Expand All @@ -108,6 +164,7 @@ exports[`find-python-projects finds projects 1`] = `
"test": "poe test",
},
"directory": "test-fixtures/multi-project/project-6",
"exports": {},
"name": "sub-project-6",
"path": "test-fixtures/multi-project/project-6/pyproject.toml",
"pythonVersion": "^3.9",
Expand All @@ -123,6 +180,7 @@ exports[`find-python-projects finds projects 1`] = `
"test": "poetry run pytest",
},
"directory": "test-fixtures/multi-project/project-2",
"exports": {},
"name": "sub-project-2",
"path": "test-fixtures/multi-project/project-2/pyproject.toml",
"pythonVersion": "^3.9",
Expand All @@ -138,6 +196,7 @@ exports[`find-python-projects finds projects 1`] = `
"test": "poetry run pytest",
},
"directory": "test-fixtures/multi-project/project-2",
"exports": {},
"name": "sub-project-2",
"path": "test-fixtures/multi-project/project-2/pyproject.toml",
"pythonVersion": "^3.9",
Expand All @@ -153,6 +212,7 @@ exports[`find-python-projects finds projects 1`] = `
"test": "poetry run pytest",
},
"directory": "test-fixtures/multi-project/project-2",
"exports": {},
"name": "sub-project-2",
"path": "test-fixtures/multi-project/project-2/pyproject.toml",
"pythonVersion": "^3.9",
Expand All @@ -164,6 +224,7 @@ exports[`find-python-projects finds projects 1`] = `
"test": "pdm run test",
},
"directory": "test-fixtures/multi-project/project-5",
"exports": {},
"name": "project-5",
"path": "test-fixtures/multi-project/project-5/pyproject.toml",
"pythonVersion": "==3.12.*",
Expand All @@ -175,6 +236,7 @@ exports[`find-python-projects finds projects 1`] = `
"test": "poe test",
},
"directory": "test-fixtures/multi-project/project-6",
"exports": {},
"name": "sub-project-6",
"path": "test-fixtures/multi-project/project-6/pyproject.toml",
"pythonVersion": "^3.9",
Expand Down
10 changes: 7 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ inputs:
root-dir:
description: Directory root for where to begin recursively searching for projects. Python projects contained in this directory or lower will be discovered.
required: false
default: '.'
default: "."
additional-export-paths:
description: Additional TOML keys to export as part of the projects object. Specify them as json path strings, separated by commas. For example, "tool.upside.foo,bar.baz".
required: false
default: ""

outputs:
paths:
Expand All @@ -25,5 +29,5 @@ outputs:
description: JSON array of all found projects (`project` object) that implement a `package` command

runs:
using: 'node20'
main: 'dist/index.js'
using: "node20"
main: "dist/index.js"
Loading
Loading