From 22627e100059b090adaf2484a09db2d5568492ce Mon Sep 17 00:00:00 2001 From: Damien Retzinger Date: Sun, 10 May 2026 13:30:54 -0400 Subject: [PATCH] feat(setup-magento): prevent Magento dir from being mirrored into vendor --- .github/workflows/check-extension.yaml | 24 ------------------------ setup-magento/action.yml | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 24 deletions(-) diff --git a/.github/workflows/check-extension.yaml b/.github/workflows/check-extension.yaml index 1631ecb..1e25328 100644 --- a/.github/workflows/check-extension.yaml +++ b/.github/workflows/check-extension.yaml @@ -68,14 +68,6 @@ jobs: id: package run: echo "name=$(jq -r .name ${{ github.workspace }}/${{ inputs.path }}/composer.json)" >> $GITHUB_OUTPUT - - name: Exclude store dir from path-repo copy - shell: bash - run: | - EXT_COMPOSER="${{ github.workspace }}/${{ inputs.path }}/composer.json" - tmp="$(mktemp)" - jq '.archive.exclude = ((.archive.exclude // []) + ["/_ghamagento"] | unique)' "$EXT_COMPOSER" > "$tmp" - mv "$tmp" "$EXT_COMPOSER" - - name: Require extension working-directory: ${{ steps.setup-magento.outputs.path }} run: composer require "${{ steps.package.outputs.name }}:@dev" --no-install @@ -141,14 +133,6 @@ jobs: id: package run: echo "name=$(jq -r .name ${{ github.workspace }}/${{ inputs.path }}/composer.json)" >> $GITHUB_OUTPUT - - name: Exclude store dir from path-repo copy - shell: bash - run: | - EXT_COMPOSER="${{ github.workspace }}/${{ inputs.path }}/composer.json" - tmp="$(mktemp)" - jq '.archive.exclude = ((.archive.exclude // []) + ["/_ghamagento"] | unique)' "$EXT_COMPOSER" > "$tmp" - mv "$tmp" "$EXT_COMPOSER" - - name: Require extension working-directory: ${{ steps.setup-magento.outputs.path }} run: composer require "${{ steps.package.outputs.name }}:@dev" --no-install @@ -225,14 +209,6 @@ jobs: id: package run: echo "name=$(jq -r .name ${{ github.workspace }}/${{ inputs.path }}/composer.json)" >> $GITHUB_OUTPUT - - name: Exclude store dir from path-repo copy - shell: bash - run: | - EXT_COMPOSER="${{ github.workspace }}/${{ inputs.path }}/composer.json" - tmp="$(mktemp)" - jq '.archive.exclude = ((.archive.exclude // []) + ["/_ghamagento"] | unique)' "$EXT_COMPOSER" > "$tmp" - mv "$tmp" "$EXT_COMPOSER" - - name: Require extension working-directory: ${{ steps.setup-magento.outputs.path }} run: composer require "${{ steps.package.outputs.name }}:@dev" --no-install diff --git a/setup-magento/action.yml b/setup-magento/action.yml index 4a10029..be00909 100644 --- a/setup-magento/action.yml +++ b/setup-magento/action.yml @@ -95,6 +95,22 @@ runs: name: Ensure app/etc exists for magento composer plugin if: inputs.mode == 'extension' + - name: Prevent Magento install from being mirrored into consumer vendor + if: inputs.mode == 'extension' + shell: bash + working-directory: ${{ inputs.working-directory }} + env: + MAGENTO_DIRECTORY: ${{ steps.setup-magento-compute-directory.outputs.MAGENTO_DIRECTORY }} + run: | + line="/$MAGENTO_DIRECTORY export-ignore" + if [[ -f .gitattributes ]] && grep -qxF "$line" .gitattributes; then + exit 0 + fi + if [[ -s .gitattributes && -n "$(tail -c1 .gitattributes)" ]]; then + printf '\n' >> .gitattributes + fi + printf '%s\n' "$line" >> .gitattributes + - uses: graycoreio/github-actions-magento2/fix-magento-install@main name: Fix Magento Out of Box Install Issues with: