Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(setup-argo): use bash, fix idempotency, only restore if needed #221

Merged
merged 3 commits into from
Aug 16, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Only fetch assets when not using the cache
- Run more steps conditionally based on whether there was a cache hit
- Fix the step name in one cases (`restore` needed to become `cache`)
- Always run the PATH step but don't add the same dir to the path twice

The last one should make the action idempotent.
  • Loading branch information
iainlane committed Aug 16, 2024
commit da97ad33fdae79017668e3c1fa5fa68544a4db82
15 changes: 11 additions & 4 deletions actions/setup-argo/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ runs:
key: argo-${{ runner.os }}-${{ runner.arch }}-${{ inputs.version }}

- name: Normalize runner.os to match Argo release
if: steps.cache.outputs.cache-hit != 'true'
shell: bash
env:
OS: ${{ runner.os }}
Expand All @@ -30,17 +31,17 @@ runs:
# runner.arch options: X86, X64, ARM, or ARM64.
# argo release: arm64, amd64, ppc64le, s390x.
# If it ain't arm64 or amd64, it'll fall back to runner.arch.
- if: runner.arch == 'X64'
- if: runner.arch == 'X64' && steps.cache.outputs.cache-hit != 'true'
shell: sh
run: echo "ARCH=amd64" >> "$GITHUB_ENV"

- if: runner.arch == 'ARM64'
- if: runner.arch == 'ARM64' && steps.cache.outputs.cache-hit != 'true'
shell: sh
run: echo "ARCH=arm64" >> "$GITHUB_ENV"

- name: Fetch Github Release Asset
id: fetch_asset
if: steps.restore.outputs.cache-hit != 'true'
if: steps.cache.outputs.cache-hit != 'true'
uses: dsaltares/fetch-gh-release-asset@a40c8b4a0471f9ab81bdf73a010f74cc51476ad4 # 1.1.1
with:
repo: "argoproj/argo-workflows"
Expand All @@ -59,4 +60,10 @@ runs:
- name: Add binary to path
shell: sh
run: |
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
# Check if `argo` is already in the PATH
if command -v argo &> /dev/null; then
exit 0
fi

echo "Adding '${{ github.workspace }}/bin' to the PATH so the 'argo' binary can be found"
echo "${{ github.workspace }}/bin" >> "${GITHUB_PATH}"