Skip to content

Releases

v4

Choose a tag to compare

@abashev abashev released this 19 Oct 14:22
Immutable release. Only release title and notes can be modified.
47d9951

For open-java-format 2.98.0.2 and later.

The version to check with goes in .open-java-format-version at the repository root:

2.98.0.6
- uses: actions/checkout@v7

- uses: openjavaformat/open-java-format-action@v4
  with:
    mode: ${{ github.event_name == 'push' && 'all' || 'changed' }}

What changed since v3

  • The version input is gone. The action and the pre-commit hook both read .open-java-format-version from the repository root, so the two cannot drift apart. Without the file, or with something in it that is not a version number, both stop and say what to put there.
  • The hook no longer pins FORMATTER_VERSION at its top. A repository that copied the v3 hook takes the v4 one.
  • The log warning and the code scanning alert for a newer open-java-format release now point at .open-java-format-version, line 1.

To move from v3: put the version the workflow passed as version in .open-java-format-version, drop the input, and switch to @v4.

A workflow that pins open-java-format 2.98.0.1 should stay on @v1: that version needs --ojf, which v2 and later do not pass.

v3

v3

Choose a tag to compare

@abashev abashev released this 18 Oct 17:14
Immutable release. Only release title and notes can be modified.
25979c3

For open-java-format 2.98.0.2 and later.

- uses: actions/checkout@v7

- uses: openjavaformat/open-java-format-action@v3
  with:
    version: '2.98.0.6'
    mode: ${{ github.event_name == 'push' && 'all' || 'changed' }}

What changed since v2

  • The check for a newer open-java-format release can go to code scanning as well as the job log. With code-scanning: true and the security-events: write permission, the action uploads a SARIF file: one alert under Security → Code scanning and in the "Code scanning results" check of a pull request while the version is behind, placed on the line of the workflow that names the version, and closed on its own once the version is updated. This is off by default, so a workflow that does not ask for it runs as before. See Code scanning in the README, which shows a recommended setup with the check in the log alone and one with code scanning too.
  • version defaults to 2.98.0.6, and so does the hook's FORMATTER_VERSION.

A workflow that pins open-java-format 2.98.0.1 should stay on @v1: that version needs --ojf, which v2 and v3 do not pass.

v2

Choose a tag to compare

@abashev abashev released this 21 Sep 18:50
Immutable release. Only release title and notes can be modified.
98bff05

For open-java-format 2.98.0.2 and later.

- uses: actions/checkout@v7

- uses: openjavaformat/open-java-format-action@v2
  with:
    version: '2.98.0.2'
    mode: ${{ github.event_name == 'push' && 'all' || 'changed' }}

What changed since v1

  • The action and the pre-commit hook no longer pass --ojf: open-java-format 2.98.0.2 has a single style. Fix files locally with open-java-format --replace <files>.
  • version defaults to 2.98.0.2, and so does the hook's FORMATTER_VERSION.
  • Windows runners on x86-64 work, with the Windows binary that 2.98.0.2 ships. The hook runs under Git Bash as well.
  • actions/cache inside the action is pinned to a commit SHA, for repositories that require pinned actions.
  • The CI now runs the action and the hook against a formatted file and one that is not, on Linux and macOS on both architectures and on Windows.

A workflow that pins open-java-format 2.98.0.1 should stay on @v1: that version needs --ojf, which v2 does not pass.

v1

Choose a tag to compare

@abashev abashev released this 15 Sep 19:10
Immutable release. Only release title and notes can be modified.
c92d916

First release of the GitHub Action for open-java-format.

Checks the formatting of Java files with the open-java-format native binary, downloaded from Maven Central — no Java, Maven or Gradle needed on the runner. The same check also comes as a git pre-commit hook.

- uses: actions/checkout@v7

- uses: openjavaformat/open-java-format-action@v1
  with:
    version: '2.98.0.1'
    mode: ${{ github.event_name == 'push' && 'all' || 'changed' }}

What's in it

  • mode: changed checks only the files of the pull request or push, mode: all checks every .java file
  • Files are checked in the open-java-format style (--ojf); fix them locally with open-java-format --ojf --replace <files>
  • Files matching .open-java-format-exclude in the repository root are skipped, by the action and the hook alike
  • A warning when a newer open-java-format release is out
  • Native binaries for Linux x86_64 and aarch64 (glibc), macOS Apple Silicon and Intel