From e4e7e178eb7ba8136719362eb3a696405a1d7c9b Mon Sep 17 00:00:00 2001 From: Jonathan Hong <119632588+gjonathanhong@users.noreply.github.com> Date: Wed, 26 Jun 2024 21:41:19 +0000 Subject: [PATCH] Use Checkout action --- .../load-workflow-variables/action.yml | 28 ++++++------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/.github/actions/load-workflow-variables/action.yml b/.github/actions/load-workflow-variables/action.yml index 415cdbd..37818b3 100644 --- a/.github/actions/load-workflow-variables/action.yml +++ b/.github/actions/load-workflow-variables/action.yml @@ -34,31 +34,19 @@ runs: using: 'composite' steps: - name: 'Get Approved Configuration File' - id: 'get_url' - uses: 'actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea' # ratchet:actions/github-script@v7 + uses: 'actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11' # ratchet:actions/checkout@v4 with: - script: |- - const resp = await github.rest.repos.getContent({ - owner: "${{ github.event.repository.owner.login }}", - repo: "${{ github.event.repository.name }}", - path: "${{ inputs.filepath }}", - ref: "${{ github.event.repository.default_branch }}" - }); - core.setOutput('download_url', resp.data.download_url); - - name: 'Download Configuration File' - shell: 'bash' - run: |- - FILENAME="${{ github.workspace }}/config.yml" - curl "${{ steps.get_url.outputs.download_url }}" \ - --location \ - --header "Authorization: Token ${{ github.token }}" \ - --output "${FILENAME}" - echo "::notice::Wrote configuration file to ${FILENAME}" + ref: '${{ github.event.repository.default_branch }}' + path: '${{ github.sha }}' + sparse-checkout: | + '${{ inputs.filepath }}' + sparse-checkout-cone-mode: false + - name: 'Load Workflow Variables' shell: 'bash' env: WORKING_DIRECTORY: '${{ inputs.working_directory }}' - FILEPATH: '${{ github.workspace }}/config.yml' + FILEPATH: '${{ github.sha }}/${{ filepath }}' FAIL_ON_MISSING: '${{ inputs.fail_on_missing }}' run: |- FILEPATH=$(realpath "${FILEPATH}")