Skip to content

Commit 856d2df

Browse files
authored
feat: add fix-magento action (#86)
1 parent d893621 commit 856d2df

File tree

3 files changed

+89
-8
lines changed

3 files changed

+89
-8
lines changed

README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,16 @@ Opinionated Github Actions and Workflows to make building, testing, and maintain
1717

1818
## Workflows
1919

20-
| Workflow Name | Description |
21-
| -------------------------------------------------------- | ---------------------------------------------------------------------- |
20+
| Workflow Name | Description |
21+
| ------------------------------------------------------------- | ---------------------------------------------------------------------- |
2222
| [Integration Test](./.github/workflows/integration-README.md) | A Github Workflow that runs the Integration Tests of a Magento Package |
2323

2424
## Actions
2525

26-
| Action Name | Description |
27-
| ------------------------------------------------ | ------------------------------------------------------------------ |
28-
| [Unit Test](./unit-test/README.md) | A Github Action that runs the Unit Tests a Magento Package |
29-
| [Get Magento Version](./get-magento-version/README.md) | A Github Action that computes the installed Magento version. |
30-
| [Installation Test](./installation-test/README.md) | A Github Action that tests the installability of a Magento Package |
31-
| [Supported Version](./supported-version/README.md) | A Github Action that computes the currently supported Github Actions Matrix for Magento 2 |
26+
| Action Name | Description |
27+
| ------------------------------------------------------ | ----------------------------------------------------------------------------------------- |
28+
| [Unit Test](./unit-test/README.md) | A Github Action that runs the Unit Tests a Magento Package |
29+
| [Fix Magento Install](./fix-magento-install/README.md) | A Github Action that fixes Magento before `composer install` |
30+
| [Get Magento Version](./get-magento-version/README.md) | A Github Action that computes the installed Magento version. |
31+
| [Installation Test](./installation-test/README.md) | A Github Action that tests the installability of a Magento Package |
32+
| [Supported Version](./supported-version/README.md) | A Github Action that computes the currently supported Github Actions Matrix for Magento 2 |

fix-magento-install/README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Fix Magento
2+
3+
A Github Action that fixes Magento before `composer install`.
4+
5+
> 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.
6+
7+
## Inputs
8+
9+
See the [action.yml](./action.yml)
10+
11+
## Usage
12+
13+
```yml
14+
name: Fix Magento Install
15+
16+
on:
17+
push:
18+
branches:
19+
- main
20+
pull_request:
21+
branches:
22+
- main
23+
24+
jobs:
25+
fix:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v3
29+
- uses: graycoreio/github-actions-magento2/fix-magento-install@main
30+
with:
31+
magento_directory: path/to/magento
32+
```

fix-magento-install/action.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: "Fix Magento Install"
2+
author: "Graycore"
3+
description: "A Github Action that fixes Magento before `composer install`"
4+
inputs:
5+
magento_directory:
6+
required: true
7+
description: "The folder where Magento is installed"
8+
9+
runs:
10+
using: "composite"
11+
steps:
12+
- uses: graycoreio/github-actions-magento2/get-magento-version@main
13+
id: init-magento-get-magento-version
14+
with:
15+
working-directory: ${{ inputs.magento_directory }}
16+
17+
- run: echo "::set-output name=version::$(composer --version | awk '{print $3}')"
18+
shell: bash
19+
name: Compute Composer Version
20+
id: init-magento-get-composer-version
21+
22+
- run: composer require monolog/monolog:"<2.7.0" --no-update
23+
shell: bash
24+
name: Fixup Monolog (https://github.com/magento/magento2/pull/35596)
25+
working-directory: ${{ inputs.magento_directory }}
26+
if: |
27+
steps.init-magento-get-magento-version.outputs.version == '"2.4.4"'
28+
29+
- run: composer require "dotmailer/dotmailer-magento2-extension-package:4.6.0-p2 as 4.6.0" --no-update
30+
shell: bash
31+
name: Fixup Dotmailer (https://devdocs.magento.com/guides/v2.4/release-notes/release-notes-2-4-0-commerce.html#dotdigital-1)
32+
working-directory: ${{ inputs.magento_directory }}
33+
if: |
34+
steps.init-magento-get-magento-version.outputs.version == '"2.4.0"'
35+
36+
- run: |
37+
composer config --no-interaction allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
38+
composer config --no-interaction allow-plugins.laminas/laminas-dependency-plugin true
39+
composer config --no-interaction allow-plugins.magento/* true
40+
name: Fixup Composer Plugins
41+
shell: bash
42+
working-directory: ${{ inputs.magento_directory }}
43+
if: |
44+
!startsWith(steps.init-magento-get-composer-version.outputs.version, 1)
45+
46+
branding:
47+
icon: "code"
48+
color: "green"

0 commit comments

Comments
 (0)