From 186797573cece68a3de8b8a7dd6deb12c86f46fe Mon Sep 17 00:00:00 2001 From: Maria Hutt Date: Fri, 21 Jul 2023 10:50:29 -0700 Subject: [PATCH] refactor(ga-screenshots): strip ion- prefix --- .../actions/test-core-screenshot/action.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/actions/test-core-screenshot/action.yml b/.github/workflows/actions/test-core-screenshot/action.yml index f3acb2bf9e..624d3c2e62 100644 --- a/.github/workflows/actions/test-core-screenshot/action.yml +++ b/.github/workflows/actions/test-core-screenshot/action.yml @@ -28,16 +28,20 @@ runs: run: npm install && npx playwright install && npx playwright install-deps shell: bash working-directory: ./core + - name: Clean Component Name + # Remove `ion-` prefix from component name if it exists. + run: | + echo "component=$(echo ${{ inputs.component }} | sed 's/ion-//')" >> $GITHUB_OUTPUT - name: Set Test File # Screenshots can be updated for all components or a single component. # If a single component is specified, then the test has the option to # - run all the file paths that have the component name in them. For example: if the component is "item", then the test will run all the file paths that have "item" in them. # - run all the file paths that are in the component folder. For example: if the component is "item", then the test will run all the file paths that are in the "src/components/item/" folder. run: | - if [ -n "${{ inputs.component }}" ] && [ "${{ inputs.component-folder }}" == "true" ]; then - echo "testFile=$(echo 'src/components/${{ inputs.component }}/')" >> $GITHUB_OUTPUT - elif [ -n "${{ inputs.component }}" ]; then - echo "testFile=$(echo '${{ inputs.component }}')" >> $GITHUB_OUTPUT + if [ -n "${{ steps.clean-component-name.outputs.component }}" ] && [ "${{ inputs.component-folder }}" == "true" ]; then + echo "testFile=$(echo 'src/components/${{ steps.clean-component-name.outputs.component }}/')" >> $GITHUB_OUTPUT + elif [ -n "${{ steps.clean-component-name.outputs.component }}" ]; then + echo "testFile=$(echo '${{ steps.clean-component-name.outputs.component }}')" >> $GITHUB_OUTPUT else echo "testFile=$(echo '')" >> $GITHUB_OUTPUT fi