diff options
author | Cole Mickens <cole.mickens@gmail.com> | 2018-10-24 06:27:38 -0700 |
---|---|---|
committer | Cole Mickens <cole.mickens@gmail.com> | 2018-10-24 06:37:21 -0700 |
commit | dfee4fa635d29a3a761e70a3a1140f8221ea3861 (patch) | |
tree | 87d183c20fe1b1cc3b0a0f38c8d3e9ef980e06cd /update.sh | |
parent | 18a8b5f39af2090a1bec9a9b8f705f7c1db6ac03 (diff) |
update.sh: fixup github api usage
Diffstat (limited to 'update.sh')
-rwxr-xr-x | update.sh | 12 |
1 files changed, 3 insertions, 9 deletions
@@ -2,17 +2,11 @@ set -euo pipefail set -x -## -## use github api to get latest commit for a repo -## use nix-prefetch-url to get the hash -## update files in place with `update-source-version` -## - export nixpkgs=/etc/nixpkgs-sway export NIX_PATH=nixpkgs=${nixpkgs} -# TODO: ew -token="$(cat /etc/nixos/secrets/github-colebot-token)" +GHUSER="${GHUSER:-"$(cat /etc/nixos/secrets/github-username)"}" +GHPASS="${GHPASS:-"$(cat /etc/nixos/secrets/github-token)"}" # update: <derivation-name> <github-repo-owner> <github-repo-name> <ref> function update() { @@ -20,7 +14,7 @@ function update() { owner="${2}" repo="${3}" ref="${4}" - rev="$(curl -u colebot:$token --silent --fail "https://api.github.com/repos/${owner}/${repo}/commits?sha=${ref}" | jq -r ".[0].sha")" + rev="$(curl -u "${GHUSER}:${GHPASS}" --silent --fail "https://api.github.com/repos/${owner}/${repo}/commits?sha=${ref}" | jq -r ".[0].sha")" sha256="$(nix-prefetch-url --unpack "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz" 2>/dev/null)" mkdir -p "./${attr}" |