-
-
Notifications
You must be signed in to change notification settings - Fork 13
63 lines (62 loc) · 1.73 KB
/
test.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: Test
on:
push:
branches:
- main
pull_request:
jobs:
test-check:
name: runner / black-format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./
id: black_format
with:
fail_on_error: "false"
- name: Check if code is left untouched (not formatted)
run: |
changed_files=$(git status --porcelain | wc -l)
if [[ ${changed_files} -eq 0 ]]; then
echo "No changes detected!"
else
echo "Changes detected!"
exit 1
fi
- name: Check 'is_formatted' output value
run: |
formatted=${{ steps.black_format.outputs.is_formatted }}
if [[ ${formatted} != "false" ]]; then
echo "'is_formatted' output invalid!"
exit 1
else
echo "'is_formatted' output valid."
fi
test-format:
name: runner / black-format (format)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./
id: black_format
with:
black_args: "."
fail_on_error: "false"
- name: Check if formatting was successful
run: |
changed_files=$(git status --porcelain | wc -l)
if [[ ${changed_files} -eq 0 ]]; then
echo "No changes detected!"
exit 1
else
echo "Changes detected!"
fi
- name: Check 'is_formatted' output value
run: |
formatted=${{ steps.black_format.outputs.is_formatted }}
if [[ ${formatted} == "false" ]]; then
echo "'is_formatted' output invalid!"
exit 1
else
echo "'is_formatted' output valid."
fi