v2.31.0-dev19 35467d7

action.yml RawHistoryFolder

1name: 'Setup Gordon'
2description: 'Install the Gordon CLI binary into the runner PATH'
3author: 'Gordon Contributors'
4
5branding:
6  icon: 'download-cloud'
7  color: 'blue'
8
9inputs:
10  version:
11    description: 'Gordon version to install (e.g. v2.0.0 or latest)'
12    required: false
13    default: 'latest'
14
15outputs:
16  version:
17    description: 'The version of Gordon that was installed'
18    value: ${{ steps.install.outputs.version }}
19  path:
20    description: 'Path to the installed Gordon binary'
21    value: ${{ steps.install.outputs.path }}
22
23runs:
24  using: 'composite'
25  steps:
26    - name: Install Gordon
27      id: install
28      shell: bash
29      env:
30        GORDON_VERSION_INPUT: ${{ inputs.version }}
31      run: |
32        set -euo pipefail
33
34        # Map RUNNER_OS to gordon OS identifier
35        case "${RUNNER_OS}" in
36          Linux)  os="linux" ;;
37          macOS)  os="darwin" ;;
38          *)      echo "Unsupported OS: ${RUNNER_OS}" >&2; exit 1 ;;
39        esac
40
41        # Map RUNNER_ARCH to gordon arch identifier
42        case "${RUNNER_ARCH}" in
43          X64)    arch="amd64" ;;
44          ARM64)  arch="arm64" ;;
45          *)      echo "Unsupported architecture: ${RUNNER_ARCH}" >&2; exit 1 ;;
46        esac
47
48        version="${GORDON_VERSION_INPUT}"
49        if ! [[ "${version}" =~ ^(latest|v?[0-9]+\.[0-9]+\.[0-9]+([-+][0-9A-Za-z.-]+)?)$ ]]; then
50          echo "Invalid Gordon version: ${version}" >&2
51          exit 1
52        fi
53
54        # Resolve 'latest' to an actual tag via redirect URL
55        if [ "${version}" = "latest" ]; then
56          redirect_url="$(curl -fsSL -o /dev/null -w '%{redirect_url}' "https://github.com/bnema/gordon/releases/latest")"
57          version="${redirect_url##*/}"
58          if [ -z "${version}" ]; then
59            echo "Failed to resolve latest Gordon version" >&2
60            exit 1
61          fi
62          if ! [[ "${version}" =~ ^v?[0-9]+\.[0-9]+\.[0-9]+([-+][0-9A-Za-z.-]+)?$ ]]; then
63            echo "Resolved invalid Gordon version: ${version}" >&2
64            exit 1
65          fi
66        fi
67
68        archive="gordon_${os}_${arch}.tar.gz"
69        base_url="https://github.com/bnema/gordon/releases/download/${version}"
70        url="${base_url}/${archive}"
71        checksums_url="${base_url}/checksums.txt"
72        work_dir="$(mktemp -d)"
73        dest="${work_dir}/${archive}"
74        checksums="${work_dir}/checksums.txt"
75        extract_dir="${work_dir}/extract"
76        install_path="/usr/local/bin/gordon"
77        trap 'rm -rf "${work_dir}"' EXIT
78
79        echo "Installing Gordon ${version} (${os}/${arch}) from ${url}"
80
81        # Download the release archive and checksums
82        curl -fsSL -o "${checksums}" "${checksums_url}"
83        curl -fsSL -o "${dest}" "${url}"
84
85        # Verify checksum before extraction
86        archive_escaped="$(printf '%s\n' "${archive}" | sed 's/[.[\\*^$()+?{|]/\\\\&/g')"
87        checksum_lines="$(grep -E "^[0-9a-fA-F]{64}[[:space:]]+\\*?${archive_escaped}$" "${checksums}" || true)"
88        if [ "$(printf '%s\n' "${checksum_lines}" | sed '/^$/d' | wc -l | tr -d ' ')" != "1" ]; then
89          echo "Expected exactly one checksum for ${archive} in checksums.txt" >&2
90          exit 1
91        fi
92        expected="$(printf '%s\n' "${checksum_lines}" | awk '{print $1}')"
93        if command -v sha256sum >/dev/null 2>&1; then
94          actual="$(sha256sum "${dest}" | awk '{print $1}')"
95        elif command -v shasum >/dev/null 2>&1; then
96          actual="$(shasum -a 256 "${dest}" | awk '{print $1}')"
97        else
98          echo "Neither sha256sum nor shasum is available for checksum verification" >&2
99          exit 1
100        fi
101        if [ "${expected}" != "${actual}" ]; then
102          echo "Checksum verification failed for ${archive}" >&2
103          echo "Expected: ${expected}" >&2
104          echo "Actual:   ${actual}" >&2
105          exit 1
106        fi
107
108        # Extract just the gordon binary and reject symlinks/directories
109        mkdir -p "${extract_dir}"
110        tar -xzf "${dest}" -C "${extract_dir}" gordon
111        binary="${extract_dir}/gordon"
112        if [ ! -f "${binary}" ] || [ -L "${binary}" ]; then
113          echo "Archive did not contain a regular Gordon binary" >&2
114          exit 1
115        fi
116
117        # Install with explicit executable permissions and verify
118        if [ -w "$(dirname "${install_path}")" ]; then
119          install -m 0755 "${binary}" "${install_path}"
120        else
121          sudo install -m 0755 "${binary}" "${install_path}"
122        fi
123        gordon version
124
125        # Set outputs
126        echo "version=${version}" >> "${GITHUB_OUTPUT}"
127        echo "path=${install_path}" >> "${GITHUB_OUTPUT}"

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 7

Tags 106

↑↓ moveenter openesc close