Skip to content

Commit 7489d60

Browse files
committed
Point the site at v2 of the GitHub Action
v2 of openjavaformat/open-java-format-action is for 2.98.0.2 and later: it no longer passes --ojf, defaults to 2.98.0.2 and runs on Windows on x86-64 as well. The home page and the GitHub Action page now use @v2, the pre-commit hook is fetched from v2, and the action's default version reads 2.98.0.2. The action's CI ran it and the hook on Linux and macOS on both architectures and on Windows, so the page lists all three. A workflow that still pins 2.98.0.1 is told to stay on @v1, which passes that version the --ojf it needs.
1 parent 658baca commit 7489d60

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

‎docs/get-started/github-actions.md‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# GitHub Action and pre-commit
22

33
Both checks run the native binary, so they need no Java, Maven or Gradle. They work on Linux with
4-
glibc and on macOS, and stop with an error on Windows and on musl-based Linux such as Alpine.
4+
glibc, on macOS and on Windows on x86-64. There is no native binary for musl-based Linux such as
5+
Alpine or for Windows on ARM.
56

67
## Check pull requests and pushes
78

@@ -17,7 +18,7 @@ jobs:
1718
steps:
1819
- uses: actions/checkout@v7
1920

20-
- uses: openjavaformat/open-java-format-action@v1
21+
- uses: openjavaformat/open-java-format-action@v2
2122
with:
2223
version: '{{ ojf_version }}'
2324
mode: {% raw %}${{ github.event_name == 'push' && 'all' || 'changed' }}{% endraw %}
@@ -28,9 +29,12 @@ the files that are not formatted and fails the job if there are any.
2829
2930
| Input | Default | Meaning |
3031
| --- | --- | --- |
31-
| `version` | `2.98.0.1` | The formatter version to download |
32+
| `version` | `2.98.0.2` | The formatter version to download |
3233
| `mode` | `changed` | `changed` checks the files of the pull request or push, `all` checks every `.java` file |
3334

35+
A workflow that still pins 2.98.0.1 stays on `@v1`: that version needs the `--ojf` flag, which `@v2`
36+
does not pass.
37+
3438
On a pull request `changed` takes the file list from the pull request itself. On a push it compares
3539
the commits before and after, which needs that history in the checkout: either use `mode: all` for
3640
pushes, as above, or check out with `fetch-depth: 0`.
@@ -64,7 +68,7 @@ The same check can stop a commit before it reaches CI. Copy the hook script from
6468
repository into your project:
6569

6670
``` sh
67-
curl -fsSL https://raw.githubusercontent.com/openjavaformat/open-java-format-action/v1/pre-commit -o .git/hooks/pre-commit
71+
curl -fsSL https://raw.githubusercontent.com/openjavaformat/open-java-format-action/v2/pre-commit -o .git/hooks/pre-commit
6872
chmod +x .git/hooks/pre-commit
6973
```
7074

@@ -76,7 +80,7 @@ To share the hook with the whole team, keep it in the repository instead:
7680

7781
``` sh
7882
mkdir -p .githooks
79-
curl -fsSL https://raw.githubusercontent.com/openjavaformat/open-java-format-action/v1/pre-commit -o .githooks/pre-commit
83+
curl -fsSL https://raw.githubusercontent.com/openjavaformat/open-java-format-action/v2/pre-commit -o .githooks/pre-commit
8084
chmod +x .githooks/pre-commit
8185
git config core.hooksPath .githooks
8286
```

‎docs/index.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ Downloads, checksums and every option are on the [Command line](get-started/comm
139139
``` yaml title=".github/workflows/format.yml"
140140
- uses: actions/checkout@v7
141141

142-
- uses: openjavaformat/open-java-format-action@v1
142+
- uses: openjavaformat/open-java-format-action@v2
143143
with:
144144
version: '{{ ojf_version }}'
145145
```

0 commit comments

Comments
 (0)