Created
June 17, 2024 08:44
-
-
Save lukehinds/32430c37dadad316832e054240a07042 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment