feat: add fix-magento action (#86)

This commit is contained in:
Damien Retzinger
2022-10-30 12:09:15 -04:00
committed by GitHub
parent d8936216c0
commit 856d2df481
3 changed files with 89 additions and 8 deletions
+3 -2
View File
@@ -18,14 +18,15 @@ Opinionated Github Actions and Workflows to make building, testing, and maintain
## Workflows
| 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 |
| [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 |
+32
View File
@@ -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
```
+48
View File
@@ -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"