{"id":13615818,"url":"https://github.com/axel-op/googlejavaformat-action","last_synced_at":"2025-04-03T10:11:29.573Z","repository":{"id":43217206,"uuid":"230550585","full_name":"axel-op/googlejavaformat-action","owner":"axel-op","description":"GitHub Action that formats Java files following Google Style guidelines","archived":false,"fork":false,"pushed_at":"2024-09-28T19:43:15.000Z","size":5640,"stargazers_count":102,"open_issues_count":5,"forks_count":23,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-25T09:48:54.269Z","etag":null,"topics":["format","formatter","github-action","github-actions","google-java-format","google-java-style-guide","java","java-files"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/axel-op.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2019-12-28T03:04:09.000Z","updated_at":"2024-10-20T11:53:50.000Z","dependencies_parsed_at":"2024-01-17T00:18:30.113Z","dependency_job_id":"13424fc3-1100-4d2d-a57a-b60622604c0c","html_url":"https://github.com/axel-op/googlejavaformat-action","commit_stats":{"total_commits":66,"total_committers":11,"mean_commits":6.0,"dds":"0.21212121212121215","last_synced_commit":"0dc4ef525e7ed73d8dff50b1b062a4d441d014b5"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":"actions/container-action","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axel-op%2Fgooglejavaformat-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axel-op%2Fgooglejavaformat-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axel-op%2Fgooglejavaformat-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axel-op%2Fgooglejavaformat-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/axel-op","download_url":"https://codeload.github.com/axel-op/googlejavaformat-action/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246981173,"owners_count":20863827,"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":["format","formatter","github-action","github-actions","google-java-format","google-java-style-guide","java","java-files"],"created_at":"2024-08-01T20:01:18.462Z","updated_at":"2025-04-03T10:11:29.533Z","avatar_url":"https://github.com/axel-op.png","language":"JavaScript","readme":"# Google Java Format Action\n\nAutomatically format your Java files using [Google Java Style guidelines](https://google.github.io/styleguide/javaguide.html).\n\nThis action automatically downloads the latest release of the [Google Java Format](https://github.com/google/google-java-format) program.\n\nThis action can format your files and push the changes, or just check the formatting without committing anything.\n\nYou must checkout your repository with `actions/checkout` before calling this action (see the example).\n\n## Examples\n\nFormat all Java files in the repository and commit the changes:\n\n```yml\nname: Format\n\non:\n  push:\n    branches: [ master ]\n\njobs:\n\n  formatting:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4 # v2 minimum required\n      - uses: axel-op/googlejavaformat-action@v4\n        with:\n          args: \"--skip-sorting-imports --replace\"\n          # Recommended if you use MacOS:\n          # github-token: ${{ secrets.GITHUB_TOKEN }}\n```\n\nCheck if the formatting is correct without pushing anything:\n\n```yml\nname: Format\n\non: [ push, pull_request ]\n\njobs:\n\n  formatting:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4 # v2 minimum required\n      - uses: axel-op/googlejavaformat-action@4\n        with:\n          args: \"--set-exit-if-changed\"\n```\n\nPrint the diff of every incorrectly formatted file, and fail if there is any:\n\n```yml\nname: Format\n\non: [ push, pull_request ]\n\njobs:\n\n  formatting:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4 # v2 minimum required\n      - uses: axel-op/googlejavaformat-action@v4\n        with:\n          args: \"--replace\"\n          skip-commit: true\n      - name: Print diffs\n        run: git --no-pager diff --exit-code\n```\n\n## Inputs\n\nNone of these inputs is required, but you can add them to change the behavior of this action.\n\n### `github-token`\n\n**Recommended if you execute this action from GitHub-hosted MacOS runners or from [self-hosted runners](https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/about-self-hosted-runners)**. Because of [IP-address based rate limiting](https://github.com/actions/virtual-environments/issues/602), calling the GitHub API from any small pool of IPs, [including the GitHub-hosted MacOS runners](https://github.com/actions/runner-images/issues/602#issuecomment-602472951), can result in an error. To overcome this, provide the [`GITHUB_TOKEN`](https://docs.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token) to authenticate these calls. If you provide it, it will also be used to authenticate the commits made by this action.\n\n### `release-name`\n\nSet this input to use a [specific release of Google Java Format](https://github.com/google/google-java-format/releases). For example: `1.7`, `v1.24.0`... If left empty, the latest version compatible with your JDK will be used.\n\n### `files`\n\nA pattern to match the files to format. The default is `**/*.java`, which means that all Java files in your repository will be formatted.\n\n### `files-excluded`\n\nA pattern to match the files to be ignored. Optional.\n\n### `skip-commit`\n\nSet to `true` if you don't want the changes to be committed by this action. Default: `false`.\n\n### `commit-message`\n\nYou can specify a custom commit message. Default: `Google Java Format`.\n\n### `args`\n\nThe arguments to pass to the Google Java Format executable.\nBy default, only `--replace` is used.\n\n```console\nOptions:\n  -i, -r, -replace, --replace\n    Send formatted output back to files, not stdout.\n  --aosp, -aosp, -a\n    Use AOSP style instead of Google Style (4-space indentation).\n  --fix-imports-only\n    Fix import order and remove any unused imports, but do no other formatting.\n  --skip-sorting-imports\n    Do not fix the import order. Unused imports will still be removed.\n  --skip-removing-unused-imports\n    Do not remove unused imports. Imports will still be sorted.\n  --skip-reflowing-long-strings\n    Do not reflow string literals that exceed the column limit.\n  --skip-javadoc-formatting\n    Do not reformat javadoc.\n  --dry-run, -n\n    Prints the paths of the files whose contents would change if the formatter were run normally.\n  --set-exit-if-changed\n    Return exit code 1 if there are any formatting changes.\n  --lines, -lines, --line, -line\n    Line range(s) to format, like 5:10 (1-based; default is all).\n  --offset, -offset\n    Character offset to format (0-based; default is all).\n  --length, -length\n    Character length to format.\n  --help, -help, -h\n    Print this usage statement.\n  --version, -version, -v\n    Print the version.\n  @\u003cfilename\u003e\n    Read options and filenames from file.\n\nThe --lines, --offset, and --length flags may be given more than once.\nThe --offset and --length flags must be given an equal number of times.\nIf --lines, --offset, or --length are given, only one file may be given.\n```\n\nNote:\n\n- If you add `--dry-run` or `-n`, no commit will be made.\n- The argument `--set-exit-if-changed` will work as expected and this action will fail if some files need to be formatted.\n","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faxel-op%2Fgooglejavaformat-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faxel-op%2Fgooglejavaformat-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faxel-op%2Fgooglejavaformat-action/lists"}