Skip to content

Instantly share code, notes, and snippets.

@koji
Last active August 28, 2026 04:37
Show Gist options
  • Select an option

  • Save koji/44390ceb9a06a2c05ed76f9cd5183945 to your computer and use it in GitHub Desktop.

Select an option

Save koji/44390ceb9a06a2c05ed76f9cd5183945 to your computer and use it in GitHub Desktop.
get sha for github actions

Get sha for GitHub Actions

requirements

zsh/bash

getTagSha() {
  local repo="$1"

  if [ -z "$repo" ]; then
    echo "usage: fzf_git_tag_sha <git_repo_url>" >&2
    return 1
  fi

  git ls-remote --tags "$repo" \
    | fzf \
    | awk '{print $1}'
}

usage

getTagSha https://github.com/actions/checkout.git

powershell

function getTagSha {
    param(
        [Parameter(Mandatory = $true)]
        [string]$Repo
    )

    git ls-remote --tags $Repo `
        | fzf `
        | ForEach-Object {
            ($_ -split '\s+')[0]
        }
}

usage

getTagSha https://github.com/actions/checkout.git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment