Skip to content
Open
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
32 changes: 32 additions & 0 deletions setupGitForOSBotify/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,40 @@ outputs:
runs:
using: composite
steps:
# 1password/install-cli-action calls https://app-updates.agilebits.com/latest to resolve "latest"
# to a concrete version, and that endpoint has degraded before (see
# https://github.com/1Password/install-cli-action/issues/42). Resolve the version ourselves so we
# can fall back to the S3-backed changelog page on releases.1password.com when the primary
# resolver is down, and pass a concrete version to the install action.
- name: Resolve 1Password CLI version
id: opVersion
shell: bash
run: |
set -uo pipefail
version=""

if resp=$(curl -sSf -m 10 https://app-updates.agilebits.com/latest 2>/dev/null); then
version=$(echo "$resp" | jq -r '.CLI2.release.version // empty')
fi

if [ -z "$version" ]; then
echo "::warning title=1Password /latest endpoint degraded::Falling back to changelog scrape at releases.1password.com. See https://github.com/1Password/install-cli-action/issues/42"
version=$(curl -sSf -m 10 https://releases.1password.com/developers/cli/ 2>/dev/null \
| grep -oE '\b2\.[0-9]+\.[0-9]+\b' | sort -V -u | tail -1)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use a portable version sort in the fallback

When the primary 1Password endpoint is down on macOS runners, this fallback is the only path, but sort -V is GNU-specific; Apple's sort(1) option list has no -V version-sort flag and documents --version only as printing the program version, so the pipeline fails, version remains empty, and the action still exits with Unable to determine 1Password CLI version instead of recovering.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from Alex's Claude agent

This isn't accurate — Apple's BSD sort(1) supports -V. From man sort on macOS:

-V, --version-sort
Sort version numbers. The input lines are treated as file names in form PREFIX VERSION SUFFIX…

Verified it works correctly (macOS 26.5.2, sort reports 2.3-Apple (199)):

$ printf '2.9.0\n2.10.0\n2.35.0\n' | sort -V
2.9.0
2.10.0
2.35.0

$ printf '2.9.0\n2.10.0\n2.35.0\n' | sort
2.10.0
2.35.0
2.9.0

Plain sort puts 2.10.0 before 2.9.0 lexically; -V orders them correctly, so the flag is actually doing version-sort work, not silently being ignored. grep -oE '\b…\b' also works on BSD grep. Nothing in the fallback pipeline is GNU-specific.

BSD sort added -V long before any macOS runner image still in service (the createNewVersion / syncVersions jobs run on blacksmith-*-macos-latest, which is Sonoma+).

Comment thread
Beamanator marked this conversation as resolved.
Outdated
fi

if [ -z "$version" ]; then
echo "::error::Unable to determine 1Password CLI version from any source"
exit 1
fi

echo "Resolved op CLI version: $version"
echo "version=$version" >> "$GITHUB_OUTPUT"

- name: Install 1Password CLI
uses: 1password/install-cli-action@8d006a0d0a4fd505af7f7ce589e7f768385ff5e4 # v3
with:
version: ${{ steps.opVersion.outputs.version }}

- name: Download OSBotify GPG key
run: op read "op://${{ inputs.OP_VAULT }}/OSBotify-private-key.asc/OSBotify-private-key.asc" --force --out-file ./OSBotify-private-key.asc
Expand Down
Loading