Skip to content

Commit 854a772

Browse files
committed
Add new workflows and prettier config/ignore
1 parent 9b2b6ef commit 854a772

File tree

5 files changed

+68
-22
lines changed

5 files changed

+68
-22
lines changed

.github/workflows/java-checkstyle.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Uses: https://github.com/marketplace/actions/run-java-checkstyle
2+
# Submits review annotations based on checkstyle errors
3+
name: Java (Checkstyle)
4+
5+
on: pull_request
6+
7+
jobs:
8+
lint-java:
9+
name: Lint Java with checkstyle
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Check out Git repository
14+
uses: actions/checkout@v2
15+
16+
- name: Setup Java JDK
17+
uses: actions/[email protected]
18+
with:
19+
java-version: '12.x'
20+
21+
- name: Run checkstyle with reviewdog
22+
uses: nikitasavinov/[email protected]
23+
with:
24+
# Report reviewdog results to
25+
# GitHub PullRequest review comments
26+
# using GitHub Personal API Access Token
27+
github_token: ${{ secrets.GITHUB_TOKEN }}
28+
reporter: github-pr-review

.github/workflows/java-prettier.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Uses: https://github.com/marketplace/actions/prettier-java-action
2+
# Auto formats code using Prettier
3+
name: Java (Prettier)
4+
5+
on: pull_request
6+
7+
jobs:
8+
prettify:
9+
name: Prettify Java
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Check out Git repository
14+
uses: actions/checkout@v2
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Prettify the Java code
19+
uses: lwerner-lshigh/[email protected]
20+
with:
21+
### Prettier Options ###
22+
# --no-semi overrides prettier printing semicolons
23+
# at the ends of all statements
24+
# --tab-width 4 sets the tab width to 4 spaces
25+
# --write *.java formats all .java files
26+
prettier_options: '--no-semi --tab-width 4 --write **/*.java'
27+
branch: ${{ github.head_ref }}
28+
commit_message: 'Bot: Prettified Java code!'
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/main.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

.prettierignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Ignore workflow files
2+
*.yml
3+
4+
# Ignore markdown files
5+
*.md

.prettierrc.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"tabWidth": 4,
3+
"semi": false,
4+
"bracketSpacing": false
5+
}

0 commit comments

Comments
 (0)