-
Notifications
You must be signed in to change notification settings - Fork 2
/
action.yml
84 lines (81 loc) · 2.82 KB
/
action.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: CodeSniffer
author: discoverygarden
description: Runs static analysis on your PHP code.
inputs:
path:
description: The path (or paths) to run the analysis on.
required: false
default: ./
extensions:
description: Comma separated list of file extensions to test - used by phpcs.
required: false
default: php,module,inc,install,test,profile,theme,css,info,md,yml
suffix:
description: Allows for additional suffix to be tracked - used by phpcpd.
required: false
default: php,module,inc,install,test,profile,theme,css,info,md,yml
lint:
description: Comma separated list of file extentions to lint.
required: false
default: php,module,inc,install,test
phpcs-ignore:
description: Comma separated list of files to ignore.
required: false
default: "*.md"
phpcpd-exclude:
description: Comma separated list of files to ignore.
required: false
syntax-continue:
description: Flag to allow workflow to pass on Syntax step failure.
required: false
default: false
standards-continue:
description: Flag to allow workflow to pass on Standards step failure.
required: false
default: false
phpcpd-continue:
description: Flag to allow workflow to pass on PHPCPD step failure.
required: false
default: false
runs:
using: "composite"
steps:
- name: Installing Lint requirements
shell: bash
run: composer install
working-directory: ${{ github.action_path }}
- name: Syntax
shell: bash
continue-on-error: ${{ inputs.syntax-continue == 'true' }}
run: >
${{ github.action_path }}/vendor/bin/phpcs --standard=Generic --sniffs=Generic.PHP.Syntax
--extensions=${{ inputs.lint }} ${{ inputs.path }}
- name: Standards
shell: bash
if: always()
continue-on-error: ${{ inputs.standards-continue == 'true' }}
run: >
${{ github.action_path }}/vendor/bin/phpcs -s --standard=Drupal,DrupalPractice
--extensions=${{ inputs.extensions }} ${{ inputs.path }} --ignore=${{ inputs.phpcs-ignore }}
- name: Copy-Paste
shell: bash
if: always()
continue-on-error: ${{ inputs.phpcpd-continue == 'true' }}
run: |
output=""
IFS=',' read -ra SUFFIX <<< "${{ inputs.suffix }}"
for suffix in "${SUFFIX[@]}"; do
output="${output} --suffix=${suffix}"
done
if [ ! -z "${{ inputs.phpcpd-exclude }}" ];
then
IFS=',' read -ra EXCLUDE <<< "${{ inputs.phpcpd-exclude }}"
for exclude in "${EXCLUDE[@]}"; do
output="${output} --exclude=${exclude}"
done
fi
echo "${{ github.action_path }}/vendor/bin/phpcpd ${output} ${{ inputs.path }}"
${{ github.action_path }}/vendor/bin/phpcpd ${output} ${{ inputs.path }}
branding:
icon: 'check-square'
color: 'blue'