Add PR labels to force running Reviewdog checks. (#13818)
Austin S. Hemmelgarn committed
Oct 17, 2022 at 08:50 UTC
bfd9b3445019c238bcd6edcd6c99d299376f4670
1 file changed
+17
-6
.github/workflows/review.yml
+17
-6
@@ -2,7 +2,8 @@
2
# Runs various ReviewDog based checks against PR with suggested changes to improve quality
3
name: Review
4
on:
5
- pull_request: null
5
+ pull_request:
6
+ types: [opened, reopened, labeled, synchronize]
7
env:
8
DISABLE_TELEMETRY: 1
9
concurrency:
@@ -27,7 +28,9 @@ jobs:
28
- name: Check files for actionlint
29
id: actionlint
30
run: |
30
- if git diff --name-only origin/${{ github.base_ref }} HEAD | grep -Eq '\.github/workflows/.*' ; then
31
+ if [ "${{ contains(github.event.pull_request.labels.*.name, 'ci/actionlint') }}" = "true" ]; then
32
+ echo '::set-output name=run::true'
33
+ elif git diff --name-only origin/${{ github.base_ref }} HEAD | grep -Eq '\.github/workflows/.*' ; then
34
echo '::set-output name=run::true'
35
echo 'GitHub Actions workflows have changed, need to run actionlint.'
36
else
@@ -36,7 +39,9 @@ jobs:
39
- name: Check files for eslint
40
id: eslint
41
run: |
39
- if git diff --name-only origin/${{ github.base_ref }} HEAD | grep -v "web/gui/dashboard" | grep -Eq '.*\.js|node\.d\.plugin\.in' ; then
42
+ if [ "${{ contains(github.event.pull_request.labels.*.name, 'ci/eslint') }}" = "true" ]; then
43
+ echo '::set-output name=run::true'
44
+ elif git diff --name-only origin/${{ github.base_ref }} HEAD | grep -v "web/gui/dashboard" | grep -Eq '.*\.js|node\.d\.plugin\.in' ; then
45
echo '::set-output name=run::true'
46
echo 'JS files have changed, need to run ESLint.'
47
else
@@ -45,7 +50,9 @@ jobs:
50
- name: Check files for hadolint
51
id: hadolint
52
run: |
48
- if git diff --name-only origin/${{ github.base_ref }} HEAD | grep -Eq '.*Dockerfile.*' ; then
53
+ if [ "${{ contains(github.event.pull_request.labels.*.name, 'ci/hadolint') }}" = "true" ]; then
54
+ echo '::set-output name=run::true'
55
+ elif git diff --name-only origin/${{ github.base_ref }} HEAD | grep -Eq '.*Dockerfile.*' ; then
56
echo '::set-output name=run::true'
57
echo 'Dockerfiles have changed, need to run Hadolint.'
58
else
@@ -54,7 +61,9 @@ jobs:
61
- name: Check files for shellcheck
62
id: shellcheck
63
run: |
57
- if git diff --name-only origin/${{ github.base_ref }} HEAD | grep -Eq '.*\.sh.*' ; then
64
+ if [ "${{ contains(github.event.pull_request.labels.*.name, 'ci/shellcheck') }}" = "true" ]; then
65
+ echo '::set-output name=run::true'
66
+ elif git diff --name-only origin/${{ github.base_ref }} HEAD | grep -Eq '.*\.sh.*' ; then
67
echo '::set-output name=run::true'
68
echo 'Shell scripts have changed, need to run shellcheck.'
69
else
@@ -63,7 +72,9 @@ jobs:
72
- name: Check files for yamllint
73
id: yamllint
74
run: |
66
- if git diff --name-only origin/${{ github.base_ref }} HEAD | grep -Eq '.*\.ya?ml|python\.d/.*\.conf' ; then
75
+ if [ "${{ contains(github.event.pull_request.labels.*.name, 'ci/yamllint') }}" = "true" ]; then
76
+ echo '::set-output name=run::true'
77
+ elif git diff --name-only origin/${{ github.base_ref }} HEAD | grep -Eq '.*\.ya?ml|python\.d/.*\.conf' ; then
78
echo '::set-output name=run::true'
79
echo 'YAML files have changed, need to run yamllint.'
80
else