-
Notifications
You must be signed in to change notification settings - Fork 0
41 lines (36 loc) · 1.3 KB
/
google java format.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
name: google-java-format
on: [ push, pull_request ]
jobs:
formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set BRANCH_NAME
run: |
BRANCH_NAME=$(echo "${{ github.ref }}" | awk -F'/' '{print $NF}')
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
echo "GitHub Ref: ${{ github.ref }}"
echo "Branch Name: $BRANCH_NAME"
echo "check.... "
ls -al
echo "check.... "
pwd
cd src/main/java/com/haemil/backend/auth
FILE_PATTERN="/home/runner/work/haemil-backend/haemil-backend/src/main/java/com/haemil/backend/${BRANCH_NAME}/*"
echo "FILE_PATTERN Name: $FILE_PATTERN"
if [[ -d "$FILE_PATTERN" ]]; then
echo "Setting FILE_PATTERN variable"
echo "FILE_PATTERN=$FILE_PATTERN" >> $GITHUB_ENV
else
echo "Directory does not exist for the given branch."
fi
- name: Check formatting
if: env.FILE_PATTERN != ''
uses: axel-op/googlejavaformat-action@v3
with:
args: "--replace"
github-token: ${{ secrets.GITHUB_TOKEN }}
skip-commit: true
files: "${{ env.FILE_PATTERN }}"
- name: Print diffs
run: git --no-pager diff --exit-code