Skip to content

Commit

Permalink
gh-actions/cache/restore: Use heredoc for creating command (#2428)
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Northey <[email protected]>
  • Loading branch information
phlax authored Nov 8, 2024
1 parent dc2854e commit 124bf71
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions gh-actions/cache/restore/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,17 @@ runs:
path: ${{ inputs.path || inputs.path-tmp }}
key: ${{ inputs.key }}
- run: |
echo "#!/bin/bash -e" > "${{ inputs.path-script }}"
# Create cache script
cat <<'EOF' >> "${{ inputs.path-script }}"
#!/bin/bash -e
set -o pipefail
${{ inputs.command }}
EOF
chmod +x "${{ inputs.path-script }}"
echo "${{ inputs.command }}" >> "${{ inputs.path-script }}"
if: ${{ inputs.command }}
- run: |
cd ${{ inputs.path || inputs.path-tmp }} || exit 1
if [[ "${{ inputs.run-as-sudo }}" == 'true' ]]; then
sudo "${{ inputs.path-script }}"
Expand Down

0 comments on commit 124bf71

Please sign in to comment.