Skip to content

Commit

Permalink
Merge branch 'mage-os:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
rhoerr authored Jul 21, 2024
2 parents a088413 + e29ea44 commit 910ec39
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions coding-standard-baseline/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ runs:
with:
list-files: shell
filters: |
baseline:
- modified: '**/**.{php,phtml,graphqls,less,css,html,xml,js}'
phpcs:
- added|modified: '**/**.{php,phtml,graphqls,less,css,html,xml,js}'
Expand All @@ -78,7 +80,7 @@ runs:
shell: bash
run: |
echo "One or more files relevant to PHPCS have changed."
echo "List all the files that have changed: ${{ steps.filter.outputs.phpcs_files }}"
echo "List all the files that have been added or changed: ${{ steps.filter.outputs.phpcs_files }}"
- name: Setup PHP
if: steps.filter.outputs.phpcs == 'true'
Expand Down Expand Up @@ -115,25 +117,25 @@ runs:
- name: Create phpcs.baseline.xml from base
shell: bash
working-directory: base
if: steps.filter.outputs.phpcs == 'true'
if: steps.filter.outputs.baseline == 'true'
run: |
php ${{ github.workspace }}/magento-coding-standard/vendor/bin/phpcs --standard=Magento2 \
$([ -n "${{ inputs.severity }}" ] && echo "--severity=${{ inputs.severity }}") \
$([ -n "${{ inputs.warning_severity }}" ] && echo "--warning-severity=${{ inputs.warning_severity }}") \
$([ -n "${{ inputs.error_severity }}" ] && echo "--error-severity=${{ inputs.error_severity }}") \
--report=\\DR\\CodeSnifferBaseline\\Reports\\Baseline --report-file=phpcs.baseline.xml \
${{ steps.filter.outputs.phpcs_files }} || /bin/true
${{ steps.filter.outputs.baseline_files }} || /bin/true
- name: Copy baseline to head
if: steps.filter.outputs.phpcs == 'true'
if: steps.filter.outputs.baseline == 'true'
shell: bash
run: |
cp ${{ github.workspace }}/base/phpcs.baseline.xml ${{ github.workspace }}/magento-coding-standard/phpcs.baseline.xml
# Since we ran phpcs in the base folder, the files in phpcs.baseline.xml contain the base folder in the path.
# We need to remove /base/ so that the phpcs can locate the correct files.
- name: Remove base dir from phpcs baseline
if: steps.filter.outputs.phpcs == 'true'
if: steps.filter.outputs.baseline == 'true'
shell: bash
run: |
sed -i "s|/base/|/|" ${{ github.workspace }}/magento-coding-standard/phpcs.baseline.xml
Expand Down

0 comments on commit 910ec39

Please sign in to comment.