{"id":16539495,"url":"https://github.com/rickstaa/action-black","last_synced_at":"2025-03-16T19:32:03.477Z","repository":{"id":43340786,"uuid":"327342893","full_name":"rickstaa/action-black","owner":"rickstaa","description":"Runs the psf/black formatter to check/format your python code.","archived":false,"fork":false,"pushed_at":"2024-03-24T19:39:21.000Z","size":56,"stargazers_count":38,"open_issues_count":5,"forks_count":12,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-20T04:05:07.824Z","etag":null,"topics":["black","codequality","continuous-integration","docker","formatter","gh-action","github-actions","github-actions-docker","python"],"latest_commit_sha":null,"homepage":"https://github.com/marketplace/actions/run-black-formatter","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rickstaa.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["rickstaa"]}},"created_at":"2021-01-06T14:52:37.000Z","updated_at":"2024-09-16T11:20:38.000Z","dependencies_parsed_at":"2024-06-18T17:04:04.326Z","dependency_job_id":null,"html_url":"https://github.com/rickstaa/action-black","commit_stats":{"total_commits":59,"total_committers":6,"mean_commits":9.833333333333334,"dds":"0.11864406779661019","last_synced_commit":"a8c265080dc5e54435950803603f5024a65400a9"},"previous_names":[],"tags_count":39,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rickstaa%2Faction-black","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rickstaa%2Faction-black/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rickstaa%2Faction-black/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rickstaa%2Faction-black/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rickstaa","download_url":"https://codeload.github.com/rickstaa/action-black/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221667364,"owners_count":16860608,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["black","codequality","continuous-integration","docker","formatter","gh-action","github-actions","github-actions-docker","python"],"created_at":"2024-10-11T18:49:17.768Z","updated_at":"2024-10-27T11:10:20.786Z","avatar_url":"https://github.com/rickstaa.png","language":"Shell","funding_links":["https://github.com/sponsors/rickstaa"],"categories":[],"sub_categories":[],"readme":"# Action-black GitHub Action\n\n[![Test](https://github.com/rickstaa/action-black/workflows/Test/badge.svg)](https://github.com/rickstaa/action-black/actions?query=workflow%3ATest)\n[![release](https://github.com/rickstaa/action-black/workflows/release/badge.svg)](https://github.com/rickstaa/action-black/actions?query=workflow%3Arelease)\n[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/rickstaa/action-black?logo=github\\\u0026sort=semver)](https://github.com/rickstaa/action-black/releases)\n[![action-bumpr supported](https://img.shields.io/badge/bumpr-supported-ff69b4?logo=github\\\u0026link=https://github.com/haya14busa/action-bumpr)](https://github.com/haya14busa/action-bumpr)\n\n\u003e [!IMPORTANT]\\\n\u003e **The official psf/black action has been released! 🚀** - Because of this, this repository's action is no longer trivial. Therefore, you are advised to use the [official black](https://black.readthedocs.io/en/stable/integrations/github_actions.html) action. Some features in this action are not in the official action. The differences between the two actions are documented in \u003chttps://github.com/rickstaa/action-black/issues/10\u003e. If you think features are missing, please open a [pull request](https://github.com/rickstaa/action-black/pulls).\n\nThis action runs the [black formatter](https://github.com/psf/black) to check/format your python code on a push or pull request. It is similar to [reviewdog/action-black](https://github.com/reviewdog/action-black) that can annotate the black changes required with [Reviewdog](https://github.com/reviewdog/reviewdog). However, this version also allows you to format the code using GitHub actions (see #advanced-use-cases).\n\n## Quickstart\n\nIn it's simplest form this action can be used to check/format your code using the black formatter.\n\n```yaml\nname: black-action\non: [push, pull_request]\njobs:\n  linter_name:\n    name: runner / black formatter\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n      - uses: rickstaa/action-black@v1\n        with:\n          black_args: \". --check\"\n```\n\n## Inputs\n\n### `black_args`\n\n**optional**: Black input arguments. Defaults to `. --check --diff`.\n\n### `fail_on_error`\n\n**optional**: Exit code when black formatting errors are found \\[true, false]. Defaults to 'true'.\n\n## Outputs\n\n### `is_formatted`\n\nBoolean specifying whether any files were formatted using the black formatter.\n\n## Advanced use cases\n\n### Annotate changes\n\nThis action can be combined with [reviewdog/action-suggester](https://github.com/reviewdog/action-suggester) also to annotate any possible changes (uses `git diff`).\n\n```yaml\nname: black-action\non: [push, pull_request]\njobs:\n  linter_name:\n    name: runner / black\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n      - name: Check files using the black formatter\n        uses: rickstaa/action-black@v1\n        id: action_black\n        with:\n          black_args: \".\"\n      - name: Annotate diff changes using reviewdog\n        if: steps.action_black.outputs.is_formatted == 'true'\n        uses: reviewdog/action-suggester@v1\n        with:\n          tool_name: blackfmt\n```\n\n### Commit changes or create a pull request\n\nThis action can be combined with [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) to also apply the annotated changes to the repository.\n\n```yaml\nname: black-action\non: [push, pull_request]\njobs:\n  linter_name:\n    name: runner / black\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n      - name: Check files using the black formatter\n        uses: rickstaa/action-black@v1\n        id: action_black\n        with:\n          black_args: \".\"\n      - name: Create Pull Request\n        if: steps.action_black.outputs.is_formatted == 'true'\n        uses: peter-evans/create-pull-request@v6\n        with:\n          token: ${{ secrets.GITHUB_TOKEN }}\n          title: \"Format Python code with psf/black push\"\n          commit-message: \":art: Format Python code with psf/black\"\n          body: |\n            There appear to be some python formatting errors in ${{ github.sha }}. This pull request\n            uses the [psf/black](https://github.com/psf/black) formatter to fix these issues.\n          base: ${{ github.head_ref }} # Creates pull request onto pull request or commit branch\n          branch: actions/black\n```\n\n## Contributing\n\nFeel free to open an issue if you have ideas on how to make this GitHub action better or if you want to report a bug! All contributions are welcome. :rocket: Please consult the [contribution guidelines](CONTRIBUTING.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frickstaa%2Faction-black","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frickstaa%2Faction-black","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frickstaa%2Faction-black/lists"}