-
Notifications
You must be signed in to change notification settings - Fork 1
/
action.yml
108 lines (108 loc) · 3.85 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: "Magento 2 coding standard analysis with PHP_CodeSniffer"
author: "Codemanufacture"
description: "Performs static code analysis with PHP_CodeSniffer and Magento 2 coding standard by default"
inputs:
standard:
description: "The name or path of the coding standard to use"
required: true
default: "Magento2"
report_style:
required: false
default: "checkstyle"
severity:
description: "The minimum severity required to display an error or warning"
required: false
warning_severity:
description: "The minimum severity required to display warning"
required: false
error_severity:
description: "The minimum severity required to display an error"
required: false
verbosity:
description: "Code Sniffer verbosity"
required: false
default: ""
phpcs_path:
description: "Path to PHP_CodeSniffer binary"
required: true
default: 'phpcs'
install_coding_standard:
description: "Installs coding standard"
required: false
default: true
coding_standard_version:
description: "Coding standard version"
required: false
default: "*"
coding_standard_package:
description: "Coding standard package name"
required: false
default: "magento/magento-coding-standard"
file_list:
description: "Working directory or file list to analyse"
required: false
default: ${{ github.workspace }}
processes:
description: "How many files should be checked simultaneously"
required: false
default: 1
extensions:
description: "A comma separated list of file extensions to check"
required: false
default: "php"
ignore_warnings_on_exit:
required: false
default: 0
ignore_errors_on_exit:
required: false
default: 0
ignore:
description: "A comma separated list of patterns to ignore files and directories"
required: false
pr_modified_files_only:
description: "Restricts analysis to modified files in a pull request"
required: false
default: true
runs:
using: "composite"
steps:
- name: Installing coding standard
shell: bash
env:
GITHUB_TOKEN: ${{ github.token }}
INPUT_CODING_STANDARD_PACKAGE: ${{ inputs.coding_standard_package }}
INPUT_CODING_STANDARD_VERSION: ${{ inputs.coding_standard_version }}
if: inputs.install_coding_standard
run: ${{ github.action_path }}/src/install_coding_standard.bash
- name: Check if phpcs exists
shell: bash
run: ${{ inputs.phpcs_path }} --version
- name: Add problem matchers
shell: bash
run:
echo "::add-matcher::${{ github.action_path }}/problem-matcher.json"
- name: Limit files in pull request
shell: bash
id: pr-files
run: echo "files=$(git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | xargs)" >> $GITHUB_OUTPUT
if: inputs.pr_modified_files_only && github.event_name == 'pull_request'
- name: Running coding standard analysis
shell: bash
run: ${{ github.action_path }}/src/run_coding_standard.bash
env:
INPUT_SEVERITY: ${{ inputs.severity }}
INPUT_ERROR_SEVERITY: ${{ inputs.error_severity }}
INPUT_WARNING_SEVERITY: ${{ inputs.warning_severity }}
INPUT_FILE_LIST: ${{ github.event_name == 'pull_request' && steps.pr-files.outputs.files || inputs.file_list }}
INPUT_PHPCS_PATH: ${{ inputs.phpcs_path }}
INPUT_IGNORE_ERRORS_ON_EXIT: ${{ inputs.ignore_errors_on_exit }}
INPUT_IGNORE_WARNINGS_ON_EXIT: ${{ inputs.ignore_warnings_on_exit }}
INPUT_EXTENSIONS: ${{ inputs.extensions }}
INPUT_PROCESSES: ${{ inputs.processes }}
INPUT_STANDARD: ${{ inputs.standard }}
INPUT_VERBOSITY: ${{ inputs.verbosity }}
INPUT_REPORT_STYLE: ${{ inputs.report_style }}
INPUT_IGNORE: ${{ inputs.ignore }}
branding:
icon: 'check-square'
color: 'blue'