From a2589b911e353bb443e62037e6868137accfb6fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Mike=C5=A1?= Date: Thu, 19 Mar 2020 11:35:49 +0100 Subject: [PATCH 1/4] Run CS Fix after Rector CI --- .github/workflows/rector_ci.yaml | 36 ++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/.github/workflows/rector_ci.yaml b/.github/workflows/rector_ci.yaml index f7c2f1382dc4..ca39d6d83f7f 100644 --- a/.github/workflows/rector_ci.yaml +++ b/.github/workflows/rector_ci.yaml @@ -36,19 +36,43 @@ jobs: coverage: none - run: composer install --no-progress + + ## First run Rector - run: composer rector-ci-fix - - name: Check for modified files + name: Check for Rector modified files id: git-check - run: echo ::set-output name=modified::$(if git diff --exit-code --no-patch; then echo "false"; else echo "true"; fi) + run: echo ::set-output name=modified_rector::$(if git diff --exit-code --no-patch; then echo "false"; else echo "true"; fi) - - name: Push changes - if: steps.git-check.outputs.modified == 'true' + - name: Git config + if: steps.git-check.outputs.modified_rector == 'true' run: | git config --global user.name 'rector-bot' git config --global user.email 'tomas@getrector.org' - git commit -am "[Rector CI] Fixed Rector issues" - git push + + - name: Commit Rector changes + if: steps.git-check.outputs.modified_rector == 'true' + run: git commit -am "fixup! [Rector CI] Fixed Rector issues" + + ## Now, there might be coding standard issues after running Rector + - + if: steps.git-check.outputs.modified_rector == 'true' + run: composer fix-cs + + - + name: Check for CS modified files + if: steps.git-check.outputs.modified_rector == 'true' + id: git-check + run: echo ::set-output name=modified_cs::$(if git diff --exit-code --no-patch; then echo "false"; else echo "true"; fi) + + - name: Commit CS changes + if: steps.git-check.outputs.modified_cs == 'true' + run: git commit -am "fixup! [Rector CI] Fixed CS issues" + + + - name: Push changes + if: steps.git-check.outputs.modified_rector == 'true' + run: git push # In case we want to fail this job when there are changed files, just add "exit 1" From 0ab75a0b74c6e7784c69528643fc2155d473527c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Mike=C5=A1?= Date: Thu, 19 Mar 2020 11:37:51 +0100 Subject: [PATCH 2/4] Dogfood --- src/Application/AppliedRectorCollector.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Application/AppliedRectorCollector.php b/src/Application/AppliedRectorCollector.php index 63859834ce6d..67260470123f 100644 --- a/src/Application/AppliedRectorCollector.php +++ b/src/Application/AppliedRectorCollector.php @@ -28,5 +28,6 @@ public function getRectorClasses(SmartFileInfo $smartFileInfo): array } return array_unique($this->rectorClassesByFile[$smartFileInfo->getRealPath()]); + return []; } } From c3d4ac40e01c122c0665d6f470e3280af0f69bab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Mike=C5=A1?= Date: Thu, 19 Mar 2020 12:35:33 +0100 Subject: [PATCH 3/4] Fix pipeline workflow --- .github/workflows/rector_ci.yaml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/rector_ci.yaml b/.github/workflows/rector_ci.yaml index ca39d6d83f7f..0831de9a1450 100644 --- a/.github/workflows/rector_ci.yaml +++ b/.github/workflows/rector_ci.yaml @@ -42,37 +42,37 @@ jobs: - name: Check for Rector modified files - id: git-check - run: echo ::set-output name=modified_rector::$(if git diff --exit-code --no-patch; then echo "false"; else echo "true"; fi) + id: rector-git-check + run: echo ::set-output name=modified::$(if git diff --exit-code --no-patch; then echo "false"; else echo "true"; fi) - name: Git config - if: steps.git-check.outputs.modified_rector == 'true' + if: steps.rector-git-check.outputs.modified == 'true' run: | git config --global user.name 'rector-bot' git config --global user.email 'tomas@getrector.org' - name: Commit Rector changes - if: steps.git-check.outputs.modified_rector == 'true' + if: steps.rector-git-check.outputs.modified == 'true' run: git commit -am "fixup! [Rector CI] Fixed Rector issues" ## Now, there might be coding standard issues after running Rector - - if: steps.git-check.outputs.modified_rector == 'true' + if: steps.rector-git-check.outputs.modified == 'true' run: composer fix-cs - name: Check for CS modified files - if: steps.git-check.outputs.modified_rector == 'true' - id: git-check - run: echo ::set-output name=modified_cs::$(if git diff --exit-code --no-patch; then echo "false"; else echo "true"; fi) + if: steps.rector-git-check.outputs.modified == 'true' + id: cs-git-check + run: echo ::set-output name=modified::$(if git diff --exit-code --no-patch; then echo "false"; else echo "true"; fi) - name: Commit CS changes - if: steps.git-check.outputs.modified_cs == 'true' + if: steps.cs-git-check.outputs.modified == 'true' run: git commit -am "fixup! [Rector CI] Fixed CS issues" - name: Push changes - if: steps.git-check.outputs.modified_rector == 'true' + if: steps.rector-git-check.outputs.modified == 'true' run: git push # In case we want to fail this job when there are changed files, just add "exit 1" From dc21275dd6ab0bd7aaa62ecdd81bf05d2815a1e3 Mon Sep 17 00:00:00 2001 From: rector-bot Date: Thu, 19 Mar 2020 11:38:35 +0000 Subject: [PATCH 4/4] fixup! [Rector CI] Fixed Rector issues --- src/Application/AppliedRectorCollector.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Application/AppliedRectorCollector.php b/src/Application/AppliedRectorCollector.php index 67260470123f..63859834ce6d 100644 --- a/src/Application/AppliedRectorCollector.php +++ b/src/Application/AppliedRectorCollector.php @@ -28,6 +28,5 @@ public function getRectorClasses(SmartFileInfo $smartFileInfo): array } return array_unique($this->rectorClassesByFile[$smartFileInfo->getRealPath()]); - return []; } }