You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Github Action for dynamically discovering Python projects in a repository and making available some helpful values from `pyproject.toml`, including CI/CD commands like `test`, for each project it finds.
2
+
GitHub Action for dynamically discovering Python projects in a repository and making available some helpful values from `pyproject.toml`, including CI/CD commands like `test`, for each project it finds.
3
3
4
4
Python projects are identified by the presence of `pyproject.toml`.
5
5
Various pieces of information about each project are parsed from `pyproject.toml` and returned in the action outputs as JSON strings, including shell commands for additional CI type operations like `test` and `package`.
6
-
This is meant to faciliate downstream actions or workflows such as matrix builds for parallel builds of each project.
6
+
This is meant to facilitate downstream actions or workflows such as matrix builds for parallel builds of each project.
7
7
8
8
This action aims to help you eliminate (or at least reduce) the amount of customization needed in your GHA workflows by pushing your project-specific stuff into `pyproject.toml`.
9
9
10
-
11
10
## Inputs
12
-
-**root-dir**: Directory root for where to begin recursively searching for projects.
13
-
Python projects contained in this directory or lower will be discovered. Defaults to your repository's root directory.
14
-
15
-
-**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".
16
11
17
-
## Outputs
18
-
-**paths**: JSON array of found project path strings
12
+
> `List` type is a newline-delimited string
13
+
> ```yaml
14
+
> exclude-commands: |
15
+
> project=my-package-1,command=test
16
+
> project=my-package-2,command=lint
17
+
> ```
19
18
20
-
-**projects**: JSON array of all found projects ([project object](#project-object-output-shape))
19
+
> `CSV` type is a comma-delimited string
20
+
> ```yaml
21
+
> additional-export-paths: tool.foo.bar,baz.qux
22
+
> ```
21
23
22
-
-**projects-by-command**: JSON object with keys corresponding to the name of discovered commands
23
-
(eg `install`, `test`, `package`, etc.) in all projects, with an array value containing each
24
-
[project object](#project-object-output-shape) that implements the command.
| `root-dir` | string | 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. |
27
+
| `additional-export-paths` | CSV | 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"`. |
28
+
| `exclude-commands` | string/List | Commands to exclude from processing during project discovery. Any plain string will be parsed as a command. For instance, passing "test" will cause the action to not export any information about "test" commands found in the repo. For project-specific overrides, pass a string of form `project=<name>,command=<name>`. For instance, a value of `project=one,command=lint` would cause the `lint` command to be excluded for a project named `one`, if such a project is discovered. Global and project-specific excludes can be freely mixed. |
| `paths` | JSON array<string> | JSON array of found project path strings. |
34
+
| `projects` | JSON array<project> | JSON array of all found projects (see [project object](#project-object-output-shape)). |
35
+
| `projects-by-command` | JSON object<string, project[]> | JSON object with keys corresponding to the name of discovered commands (e.g., `install`, `test`, `package`, etc.) in all projects, with an array value containing each [project object](#project-object-output-shape) that implements the command. |
26
36
27
37
## Project object output shape
28
38
These are the fields for `project` objects in the output:
@@ -42,12 +52,10 @@ This is dynamically constructed from the `pyproject.toml` content.
42
52
43
53
- **exports**: Object with keys specified by the `additional-export-paths` input, and the structured TOML data (parsed as JSON) as the values.
44
54
45
-
46
55
## Project Commands
47
56
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.
48
57
49
-
This action will surface any command you specify in the pyproject.toml files. Typically you'll
50
-
want to define one or more of the following for your CI/CD system::
58
+
This action will surface any command you specify in the pyproject.toml files. Typically you'll want to define one or more of the following for your CI/CD system:
51
59
52
60
- `test`
53
61
- `package`
@@ -61,7 +69,7 @@ This action will pull the command from the first entry it finds in any of the fo
This action perfoms special treatment for surfacing the `install` command. Namely, if it is not explicitly specified, the action will attempt to generate a default based on the packaging backend (eg Poetry, PDM) that it discovers.
72
+
This action performs special treatment for surfacing the `install` command. Namely, if it is not explicitly specified, the action will attempt to generate a default based on the packaging backend (eg Poetry, PDM) that it discovers.
65
73
The intent is that you do not need to specify an `install` command in your pyproject.toml, but you can if necessary.
66
74
67
75
### Where is the support for `[tool.poetry.scripts]`?
@@ -71,15 +79,11 @@ can leverage a task runner tool like [Poe](https://github.com/nat-n/poethepoet)
71
79
72
80
*If Poetry ever adds support for internal project (CI/CD/Dev) commands separate from published commands, then it will be added to this action.*
0 commit comments