diff --git a/README.md b/README.md index 672d6d3d..6418d506 100644 --- a/README.md +++ b/README.md @@ -17,15 +17,16 @@ Opinionated Github Actions and Workflows to make building, testing, and maintain ## Workflows -| Workflow Name | Description | -| -------------------------------------------------------- | ---------------------------------------------------------------------- | +| Workflow Name | Description | +| ------------------------------------------------------------- | ---------------------------------------------------------------------- | | [Integration Test](./.github/workflows/integration-README.md) | A Github Workflow that runs the Integration Tests of a Magento Package | ## Actions -| Action Name | Description | -| ------------------------------------------------ | ------------------------------------------------------------------ | -| [Unit Test](./unit-test/README.md) | A Github Action that runs the Unit Tests a Magento Package | -| [Get Magento Version](./get-magento-version/README.md) | A Github Action that computes the installed Magento version. | -| [Installation Test](./installation-test/README.md) | A Github Action that tests the installability of a Magento Package | -| [Supported Version](./supported-version/README.md) | A Github Action that computes the currently supported Github Actions Matrix for Magento 2 | \ No newline at end of file +| Action Name | Description | +| ------------------------------------------------------ | ----------------------------------------------------------------------------------------- | +| [Unit Test](./unit-test/README.md) | A Github Action that runs the Unit Tests a Magento Package | +| [Fix Magento Install](./fix-magento-install/README.md) | A Github Action that fixes Magento before `composer install` | +| [Get Magento Version](./get-magento-version/README.md) | A Github Action that computes the installed Magento version. | +| [Installation Test](./installation-test/README.md) | A Github Action that tests the installability of a Magento Package | +| [Supported Version](./supported-version/README.md) | A Github Action that computes the currently supported Github Actions Matrix for Magento 2 | \ No newline at end of file diff --git a/fix-magento-install/README.md b/fix-magento-install/README.md new file mode 100644 index 00000000..0b5f0a10 --- /dev/null +++ b/fix-magento-install/README.md @@ -0,0 +1,32 @@ +# Fix Magento + +A Github Action that fixes Magento before `composer install`. + +> You probably only need this action if you're working on a Magento extension. However, if you're working on a Magento store and your CI pipeline breaks, this is probably a good first place to look for corrective measures to take. + +## Inputs + +See the [action.yml](./action.yml) + +## Usage + +```yml +name: Fix Magento Install + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + fix: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: graycoreio/github-actions-magento2/fix-magento-install@main + with: + magento_directory: path/to/magento +``` diff --git a/fix-magento-install/action.yml b/fix-magento-install/action.yml new file mode 100644 index 00000000..317ad2a1 --- /dev/null +++ b/fix-magento-install/action.yml @@ -0,0 +1,48 @@ +name: "Fix Magento Install" +author: "Graycore" +description: "A Github Action that fixes Magento before `composer install`" +inputs: + magento_directory: + required: true + description: "The folder where Magento is installed" + +runs: + using: "composite" + steps: + - uses: graycoreio/github-actions-magento2/get-magento-version@main + id: init-magento-get-magento-version + with: + working-directory: ${{ inputs.magento_directory }} + + - run: echo "::set-output name=version::$(composer --version | awk '{print $3}')" + shell: bash + name: Compute Composer Version + id: init-magento-get-composer-version + + - run: composer require monolog/monolog:"<2.7.0" --no-update + shell: bash + name: Fixup Monolog (https://github.com/magento/magento2/pull/35596) + working-directory: ${{ inputs.magento_directory }} + if: | + steps.init-magento-get-magento-version.outputs.version == '"2.4.4"' + + - run: composer require "dotmailer/dotmailer-magento2-extension-package:4.6.0-p2 as 4.6.0" --no-update + shell: bash + name: Fixup Dotmailer (https://devdocs.magento.com/guides/v2.4/release-notes/release-notes-2-4-0-commerce.html#dotdigital-1) + working-directory: ${{ inputs.magento_directory }} + if: | + steps.init-magento-get-magento-version.outputs.version == '"2.4.0"' + + - run: | + composer config --no-interaction allow-plugins.dealerdirect/phpcodesniffer-composer-installer true + composer config --no-interaction allow-plugins.laminas/laminas-dependency-plugin true + composer config --no-interaction allow-plugins.magento/* true + name: Fixup Composer Plugins + shell: bash + working-directory: ${{ inputs.magento_directory }} + if: | + !startsWith(steps.init-magento-get-composer-version.outputs.version, 1) + +branding: + icon: "code" + color: "green"