-
Notifications
You must be signed in to change notification settings - Fork 14
103 lines (100 loc) · 3.32 KB
/
Copy pathcheck.yml
File metadata and controls
103 lines (100 loc) · 3.32 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#
#
# Copyright 2016 CUBRID Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
name: github-checks
on:
pull_request:
branches:
- develop
- 'feature/**'
jobs:
license:
name: license
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: jitterbit/get-changed-files@v1
id: files
continue-on-error: true
- name: Check license
run: |
set +e # make this step proceed even if a command returns non-zero
license_headers=.github/workflows/license_headers
result="PASS"
for f in ${{ steps.files.outputs.added_modified }}; do
if [ -d "$f" ]; then
continue
fi
ext=$(expr $f : ".*\(\..*\)")
case $ext in
.java) true;; # only these formats are checked.
*) continue ;; # skip others
esac
result_for_f="FAIL"
for header in `find $license_headers -type f`; do
line_cnt=`wc -l < $header`
head -n $line_cnt $f | diff -w - $header 2>&1 1>/dev/null
if [ $? -eq 0 ]; then
result_for_f="PASS"
break
fi
done
echo "$f: $result_for_f"
if [ "$result_for_f" = "FAIL" ]; then
result="FAIL"
fi
done
test $result = "PASS" # if non-zero, fail
pr-style:
name: pr-style
runs-on: ubuntu-latest
steps:
- uses: deepakputhraya/action-pr-title@master
with:
regex: '^\[[A-Z]+-\d+\]\s.+'
code-style:
name: code-style
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '8'
- name: Download google-java-format 1.7
run: |
wget -q -O "$RUNNER_TEMP/gjf.jar" \
https://github.com/CUBRID/3rdparty/raw/develop/google-java-format/google-java-format-1.7-all-deps.jar
- id: changed
uses: tj-actions/changed-files@24d32ffd492484c1d75e0c0b894501ddb9d30d62
with:
files: "**/*.java"
write_output_files: true
- name: Run google-java-format 1.7 on changed files
if: ${{ steps.changed.outputs.any_changed == 'true' }}
run: |
echo "Running google-java-format on changed files..."
java -jar "$RUNNER_TEMP/gjf.jar" \
--aosp --replace --set-exit-if-changed @.github/outputs/all_changed_files.txt
- name: Suggest code changes
if: ${{ failure() }}
uses: reviewdog/action-suggester@aa38384ceb608d00f84b4690cacc83a5aba307ff
with:
tool_name: code-style (indent, googlejavaformat)