Repository navigation
79 lines (73 loc) · 2.64 KB
/
Copy pathcheckpatch.yml
File metadata and controls
79 lines (73 loc) · 2.64 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
---
# SPDX-License-Identifier: GPL-2.0-or-later
#
# This file is part of nvme.
# Copyright (c) 2026 SUSE LLC
#
# Authors: Daniel Wagner <dwagner@suse.de>
name: Checkpatch
on:
pull_request:
workflow_dispatch:
schedule:
- cron: '41 21 * * *'
concurrency:
# A new push to a pull request cancels its older run. Each push to
# master gets a run of its own, to show which commit broke something.
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: read
# A pull request reads only the caches of its own branch and of the
# default branch. So only a run on the default branch saves the copy of
# checkpatch.pl. A scheduled run always runs there.
jobs:
refresh:
name: refresh checkpatch.pl
if: ${{ github.event_name != 'pull_request' &&
github.ref_name == github.event.repository.default_branch }}
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Fetch checkpatch.pl
run: |
curl -sSf \
https://raw.githubusercontent.com/torvalds/linux/master/scripts/checkpatch.pl \
-o checkpatch.pl
- uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: checkpatch.pl
key: checkpatch-${{ github.run_id }}
checkpatch:
name: checkpatch review
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
# The newest saved copy. No key is an exact match.
- uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: checkpatch.pl
key: checkpatch-
restore-keys: checkpatch-
- name: Fetch checkpatch.pl if no copy was saved
run: |
[ -f checkpatch.pl ] && exit 0
curl -sSf \
https://raw.githubusercontent.com/torvalds/linux/master/scripts/checkpatch.pl \
-o checkpatch.pl
# --git checks each commit on its own. Piping a whole series in as
# one patch makes the author's Signed-off-by in every commit after
# the first a "Duplicate signature".
#
# scripts/checkpatch-filter.pl drops known false positives and sets
# the exit status. The shell does not use pipefail, so checkpatch's
# own exit status is ignored.
- name: Run checkpatch review
run: |
perl checkpatch.pl --git origin/${{ github.base_ref }}..HEAD 2>&1 |
perl scripts/checkpatch-filter.pl