Skip to content

Commit

Permalink
Fix load-workflow-variables issue where config file cannot be found
Browse files Browse the repository at this point in the history
  • Loading branch information
gjonathanhong committed Sep 27, 2024
1 parent 988e95e commit c3d7a36
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions .github/actions/load-workflow-variables/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down

0 comments on commit c3d7a36

Please sign in to comment.