#!/bin/bash

# Function to get the SHA for a specific tag
get_sha_for_tag() {
  local owner_repo=$1
  local tag=$2
  curl -s "https://api.github.com/repos/$owner_repo/git/ref/tags/$tag" | jq -r '.object.sha'
}

# Example usage
# Set the owner/repo and tag you are interested in
OWNER_REPO="actions/checkout"
TAG="v2"

# Get the SHA for the specified tag
SHA=$(get_sha_for_tag $OWNER_REPO $TAG)

# Print the uses line for the workflow
echo "- uses: $OWNER_REPO@$SHA"