https://github.com/project-monai/monai-code-formatter
A github action for automatically formatting source code files for MONAI
https://github.com/project-monai/monai-code-formatter
Last synced: 6 months ago
JSON representation
A github action for automatically formatting source code files for MONAI
- Host: GitHub
- URL: https://github.com/project-monai/monai-code-formatter
- Owner: Project-MONAI
- License: apache-2.0
- Created: 2020-05-04T12:39:31.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2025-01-25T11:06:10.000Z (about 1 year ago)
- Last Synced: 2025-01-25T18:33:57.420Z (about 1 year ago)
- Language: HTML
- Homepage:
- Size: 217 MB
- Stars: 4
- Watchers: 8
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Python code formatter
This repo implements two options to format python code with Black using GitHub action.
The formatting changes are submitted back to the source branch (PR that triggered the action).
#### option 1 using a formatter workflow
It does not work for pull requests from forks due to a limitation of Github token's write permission.
##### Usage
```yaml
- uses: project-monai/monai-code-formatter@master
with:
# options to the auto formatter (Black)
format_args:
# email address used to write git commit
email:
# username used to write git commit
username:
# commit message
message:
# access token used to read and write the source branch
token:
```
#### option 2 using the `repository_dispath` event
It is implemented by triggering the formatting process using the [slach command dispatch](https://github.com/marketplace/actions/slash-command-dispatch).
The workflow file is located at [`.github/workflows/format.yml`](https://github.com/Project-MONAI/monai-code-formatter/blob/master/.github/workflows/format.yml).
MONAI currently adopts this option as it supports both internal and external pull requests,
given that the contributors use the default PR setting -- 'Allow edits and access to secrets by maintainers'.
repo stats: https://monai.io/monai-code-formatter/Project-MONAI/MONAI/latest-report/report.html
tutorial stats: https://monai.io/monai-code-formatter/Project-MONAI/tutorials/latest-report/report.html