From c3d7a36e16d5d4b70d25da3368f7dfcad4b4aee7 Mon Sep 17 00:00:00 2001 From: Jonathan Hong <119632588+gjonathanhong@users.noreply.github.com> Date: Fri, 27 Sep 2024 17:13:42 +0000 Subject: [PATCH] Fix load-workflow-variables issue where config file cannot be found --- .github/actions/load-workflow-variables/action.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/actions/load-workflow-variables/action.yml b/.github/actions/load-workflow-variables/action.yml index 7acb533..d88ae38 100644 --- a/.github/actions/load-workflow-variables/action.yml +++ b/.github/actions/load-workflow-variables/action.yml @@ -33,20 +33,30 @@ inputs: runs: using: 'composite' steps: + - name: 'Sanitize Input Filepath' + id: 'sanitize_filepath' + shell: 'bash' + env: + CONFIG_REL_PATH: '${{ inputs.filepath }}' + run: |- + relpath=${CONFIG_REL_PATH} + filepath=$(echo "$relpath" | sed 's/^\.\///') + echo "CONFIG_PATH=$filepath" >> "$GITHUB_OUTPUT" + - name: 'Get Approved Configuration File' uses: 'actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11' # ratchet:actions/checkout@v4 with: ref: '${{ github.event.repository.default_branch }}' path: 'load-workflow-variables/${{ github.sha }}' sparse-checkout: | - ${{ inputs.filepath }} + ${{ steps.sanitize_filepath.outputs.CONFIG_PATH }} sparse-checkout-cone-mode: 'false' - name: 'Load Workflow Variables' shell: 'bash' env: WORKING_DIRECTORY: '${{ inputs.working_directory }}' - FILEPATH: 'load-workflow-variables/${{ github.sha }}/${{ inputs.filepath }}' + FILEPATH: 'load-workflow-variables/${{ github.sha }}/${{ steps.sanitize_filepath.outputs.CONFIG_PATH }}' FAIL_ON_MISSING: '${{ inputs.fail_on_missing }}' run: |- FILEPATH=$(realpath "${FILEPATH}")