Skip to content

Commit e29ea44

Browse files
authored
fix: coding-standard-baseline: Run baseline test on modified files only (fixes #227) (#228)
1 parent a326271 commit e29ea44

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

coding-standard-baseline/action.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ runs:
7070
with:
7171
list-files: shell
7272
filters: |
73+
baseline:
74+
- modified: '**/**.{php,phtml,graphqls,less,css,html,xml,js}'
7375
phpcs:
7476
- added|modified: '**/**.{php,phtml,graphqls,less,css,html,xml,js}'
7577
@@ -78,7 +80,7 @@ runs:
7880
shell: bash
7981
run: |
8082
echo "One or more files relevant to PHPCS have changed."
81-
echo "List all the files that have changed: ${{ steps.filter.outputs.phpcs_files }}"
83+
echo "List all the files that have been added or changed: ${{ steps.filter.outputs.phpcs_files }}"
8284
8385
- name: Setup PHP
8486
if: steps.filter.outputs.phpcs == 'true'
@@ -115,25 +117,25 @@ runs:
115117
- name: Create phpcs.baseline.xml from base
116118
shell: bash
117119
working-directory: base
118-
if: steps.filter.outputs.phpcs == 'true'
120+
if: steps.filter.outputs.baseline == 'true'
119121
run: |
120122
php ${{ github.workspace }}/magento-coding-standard/vendor/bin/phpcs --standard=Magento2 \
121123
$([ -n "${{ inputs.severity }}" ] && echo "--severity=${{ inputs.severity }}") \
122124
$([ -n "${{ inputs.warning_severity }}" ] && echo "--warning-severity=${{ inputs.warning_severity }}") \
123125
$([ -n "${{ inputs.error_severity }}" ] && echo "--error-severity=${{ inputs.error_severity }}") \
124126
--report=\\DR\\CodeSnifferBaseline\\Reports\\Baseline --report-file=phpcs.baseline.xml \
125-
${{ steps.filter.outputs.phpcs_files }} || /bin/true
127+
${{ steps.filter.outputs.baseline_files }} || /bin/true
126128
127129
- name: Copy baseline to head
128-
if: steps.filter.outputs.phpcs == 'true'
130+
if: steps.filter.outputs.baseline == 'true'
129131
shell: bash
130132
run: |
131133
cp ${{ github.workspace }}/base/phpcs.baseline.xml ${{ github.workspace }}/magento-coding-standard/phpcs.baseline.xml
132134
133135
# Since we ran phpcs in the base folder, the files in phpcs.baseline.xml contain the base folder in the path.
134136
# We need to remove /base/ so that the phpcs can locate the correct files.
135137
- name: Remove base dir from phpcs baseline
136-
if: steps.filter.outputs.phpcs == 'true'
138+
if: steps.filter.outputs.baseline == 'true'
137139
shell: bash
138140
run: |
139141
sed -i "s|/base/|/|" ${{ github.workspace }}/magento-coding-standard/phpcs.baseline.xml

0 commit comments

Comments
 (0)