diff --git a/.github/coding-standard-baseline/README.md b/.github/coding-standard-baseline/README.md
new file mode 100644
index 000000000000..68b789d574c8
--- /dev/null
+++ b/.github/coding-standard-baseline/README.md
@@ -0,0 +1,30 @@
+# Magento 2 Coding Standard Action
+
+A Github Action that runs the Magento Coding Standard.
+
+## Inputs
+
+See the [action.yml](./action.yml)
+
+## Usage
+
+```yml
+name: Coding Standard
+
+on:
+ push:
+ branches:
+ - main
+ pull_request:
+ branches:
+ - main
+
+jobs:
+ coding-standard:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: graycoreio/github-actions-magento2/coding-standard@main
+ with:
+ version: 25 # Optional, will use the latest if omitted.
+ path: app/code # Optional, will be used when event is not a pull request.
+```
diff --git a/.github/coding-standard-baseline/action.yml b/.github/coding-standard-baseline/action.yml
new file mode 100644
index 000000000000..b611120365e4
--- /dev/null
+++ b/.github/coding-standard-baseline/action.yml
@@ -0,0 +1,124 @@
+name: "M2 Coding Standard"
+author: "Mage-OS"
+description: "A Github Action that runs the Magento Coding Standard."
+
+inputs:
+ php_version:
+ type: string
+ required: true
+ default: "8.1"
+ description: "PHP version used to do the coding standard check."
+
+ composer_version:
+ type: string
+ required: true
+ default: "2"
+ description: "The version of composer to use."
+
+ path:
+ type: string
+ required: true
+ default: 'app/code'
+ description: "The directory (relative to the project root) in which the coding standard will be checked. Used when the event is not a pull request."
+
+ version:
+ type: string
+ required: false
+ default: "31"
+ description: "The version of the coding standard to use. If not provided, will use the latest version."
+
+ severity:
+ type: string
+ required: false
+ default: "8"
+ description: "The minimum severity required to display an error or warning (default: 5)"
+
+ warning_severity:
+ type: string
+ required: false
+ default: "8"
+ description: "The minimum severity required to display a warning"
+
+ error_severity:
+ type: string
+ required: false
+ default: "8"
+ description: "The minimum severity required to display an error"
+
+ baseline_version:
+ type: string
+ required: false
+ default: "1.1.2"
+ description: "version of phpcs baseline"
+
+runs:
+ using: composite
+ steps:
+ - name: Checkout Project
+ uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+
+ - name: Set PHP Version
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: ${{ inputs.php_version }}
+ tools: composer:v${{ inputs.composer_version }}
+ coverage: none
+
+ - name: Install Coding Standard && Codesniffer baseline
+ shell: bash
+ run: |
+ git config --global advice.detachedHead false
+ composer require "magento/magento-coding-standard: ${{ github.event.inputs.version || '*' }}" -W
+ composer config --no-plugins allow-plugins.digitalrevolution/php-codesniffer-baseline true
+ composer require --dev "digitalrevolution/php-codesniffer-baseline: ${{ github.event.inputs.baseline_version || '*' }}"
+
+ - name: Register Coding Standard
+ shell: bash
+ run: vendor/bin/phpcs --config-set installed_paths ${{ github.workspace }}/vendor/magento/magento-coding-standard,${{ github.workspace }}/vendor/phpcompatibility/php-compatibility
+
+ - name: Get all changed files
+ uses: tj-actions/changed-files@v37
+ with:
+ write_output_files: true
+ output_dir: ${{ github.workspace }}
+ separator: " "
+
+ - name: Verify the contents of the modified_files.txt file
+ shell: bash
+ run: |
+ sed "s/ /\n/g" ${{ github.workspace }}/modified_files.txt > ${{ github.workspace }}/newline_file.txt
+ grep -iE "\.php|\.phtml|\.html|\.xml" ${{ github.workspace }}/newline_file.txt > ${{ github.workspace }}/phpcs_files.txt
+
+ - name: Checkout - Before Merge
+ shell: bash
+ run: |
+ if ${{ github.event_name == 'pull_request' }}; then
+ git checkout ${{ github.event.pull_request.base.ref }}
+ else
+ git checkout ${{ github.event.before }}
+ fi
+
+ - name: Filter php files and execute phpcs - Before Merge
+ shell: bash
+ run: |
+ php 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=${{ github.workspace }}/phpcs.baseline.xml --file-list=${{ github.workspace }}/phpcs_files.txt || /bin/true
+
+ - name: Checkout after Merge and execute phpcs
+ shell: bash
+ run: |
+ if ${{ github.event_name == 'pull_request' }}; then
+ git checkout ${{ github.event.pull_request.head.ref }}
+ else
+ git checkout ${{ github.event.after }}
+ fi
+ php 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 }}") \
+ --file-list=${{ github.workspace }}/phpcs_files.txt
diff --git a/.github/workflows/coding-standard.yml b/.github/workflows/coding-standard.yml
index 03a87ff180d0..c3de61c37110 100644
--- a/.github/workflows/coding-standard.yml
+++ b/.github/workflows/coding-standard.yml
@@ -1,9 +1,52 @@
-name: Coding Standard
+name: M2 Coding Testing
on:
+ push:
+ branches: [ 2.4-develop, develop, phpcs_baseline ]
pull_request:
- branches:
- - 2.4-develop
+ branches: [ 2.4-develop, develop, phpcs_baseline ]
+ workflow_call:
+ inputs:
+ php_version:
+ type: string
+ required: true
+ default: "8.1"
+ description: "PHP version used to do the coding standard check."
+
+ composer_version:
+ type: string
+ required: true
+ default: "2"
+ description: "The version of composer to use."
+
+ path:
+ type: string
+ required: true
+ default: 'app/code'
+ description: "The directory (relative to the project root) in which the coding standard will be checked. Used when the event is not a pull request."
+
+ version:
+ type: string
+ required: false
+ description: "The version of the coding standard to use. If not provided, will use the latest version."
+
+ severity:
+ type: string
+ required: false
+ default: "8"
+ description: "The minimum severity required to display an error or warning (default: 5)"
+
+ warning_severity:
+ type: string
+ required: false
+ default: "8"
+ description: "The minimum severity required to display a warning"
+
+ error_severity:
+ type: string
+ required: false
+ default: "8"
+ description: "The minimum severity required to display an error"
permissions:
contents: read
@@ -12,5 +55,13 @@ jobs:
coding-standard:
runs-on: ubuntu-latest
steps:
- - name: Run Coding Standard
- uses: mage-os/github-actions/coding-standard@main
+ - uses: actions/checkout@v1
+ - uses: mage-os/github-actions/coding-standard-baseline@main
+ with:
+ php_version: "8.1" # Optional, will be used for Php version
+ composer_version: "2"
+ version: "31" # Optional, will use the latest if omitted.
+ severity: "8" # Optional, will use phpcs default of 5 if not specified.
+ warning_severity: "4" # Optional, will use warning severity value if not specified.
+ error_severity: "7" # Optional, will use error severity value if not specified.
+ baseline_version: "1.1.2" # Optional, will use for php codesniffer baseline version
diff --git a/app/code/Magento/Backup/etc/config.xml b/app/code/Magento/Backup/etc/config.xml
index fb0808983b9c..ebe94bd1ba68 100644
--- a/app/code/Magento/Backup/etc/config.xml
+++ b/app/code/Magento/Backup/etc/config.xml
@@ -10,6 +10,7 @@