-
Notifications
You must be signed in to change notification settings - Fork 11
139 lines (117 loc) · 4.27 KB
/
check-pull-request.yaml
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: Check PR
on:
pull_request:
types:
- opened
- ready_for_review
- synchronize
jobs:
pre-check:
permissions:
pull-requests: write
outputs:
src: ${{ steps.filter.outputs.src }}
runs-on: ubuntu-latest
timeout-minutes: 1
steps:
# https://github.com/dorny/paths-filter/tree/v3.0.2/
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36
id: filter
with:
filters: |
src:
- "**.dart"
- "**.yaml"
- "**/pubspec.lock"
- "scripts/**"
# https://github.com/peter-evans/create-or-update-comment/tree/v4/
- name: Comment
if: ${{ steps.filter.outputs.src == 'false' }}
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
> [!WARNING]
> チェック対象ファイルの変更がなかったため、checkジョブをスキップしました
regenerate-code:
name: Regenerate code
needs: pre-check
if: ${{ needs.pre-check.outputs.src == 'true' }}
runs-on: ubuntu-latest
timeout-minutes: 10
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions
permissions:
checks: write
contents: write
issues: write
pull-requests: write
steps:
# https://github.com/actions/checkout/tree/v4/
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
- name: Setup Application Runtime
uses: ./.github/actions/setup-application-runtime
- name: re-generated code
run: melos run rebuild --no-select
- name: format
run: melos run format --no-select
- name: check difference
run: |
git add -N .
git diff --name-only --exit-code
# https://github.com/peter-evans/create-pull-request/tree/v6/
- name: Create or update pull request
uses: peter-evans/create-pull-request@67ccf781d68cd99b580ae25a5c18a1cc84ffff1f
if: failure()
id: cpr
with:
delete-branch: true
commit-message: "Auto format"
committer: "GitHub Actions <[email protected]>"
base: ${{ github.head_ref }}
branch: "auto-format/${{ github.head_ref }}"
title: "Auto format - ${{ github.head_ref }}"
body: "Auto format by GitHub Actions on ${{ github.ref }}\nby: ${{github.actor}}"
labels: "Auto Format"
reviewers: ${{ github.actor }}
- name: Check outputs
if: ${{ steps.cpr.outputs.pull-request-number }}
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
test:
name: Check format and Run test
needs: pre-check
if: ${{ needs.pre-check.outputs.src == 'true' }}
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
# https://github.com/actions/checkout/tree/v4/
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
- name: Setup Application Runtime
uses: ./.github/actions/setup-application-runtime
# https://github.com/invertase/github-action-dart-analyzer/tree/v3/
- name: Report analyze
uses: invertase/github-action-dart-analyzer@e981b01a458d0bab71ee5da182e5b26687b7101b
with:
fatal-infos: true
- name: Report custom_lint result
run: |
echo "::add-matcher::.github/problem_matchers/custom_lint.json"
melos run report_custom_lint:ci --no-select || result=$?
echo "::remove-matcher owner=custom_lint::"
if [ -n "$result" ]; then
exit 1
fi
- name: Run test
run: melos run report_test --no-select
continue-on-error: true
# https://github.com/dorny/test-reporter/tree/v1.9.1/
- name: Report test
uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5
with:
name: "flutter test"
path: "(app|catalog|packages/**)/test_report.log"
reporter: "flutter-json"
fail-on-error: "true"