Skip to content

Instantly share code, notes, and snippets.

@pathikrit
Created April 3, 2025 22:08
Show Gist options
  • Save pathikrit/fee5e757a02e048ecf25959cd9f82f47 to your computer and use it in GitHub Desktop.
Save pathikrit/fee5e757a02e048ecf25959cd9f82f47 to your computer and use it in GitHub Desktop.
uv Run scripts from a private github repo
#!/bin/bash
# Usage: ./uv_github.sh <path_to_script> [args...]
ORG="pathikrit"
REPO="scripts"
if [ "$#" -lt 1 ]; then
echo "Usage: $0 <path_to_script> [args...]"
exit 1
fi
PATH_TO_SCRIPT="$1"
shift
tmpfile=$(mktemp "/tmp/$(basename "$PATH_TO_SCRIPT").XXXXXX")
gh api repos/"$ORG"/"$REPO"/contents/"$PATH_TO_SCRIPT" \
| jq -r .content \
| base64 --decode > "$tmpfile"
uv run "$tmpfile" "$@"
rm "$tmpfile"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment