forked from neuhausler/nuclide-remote
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils
executable file
·37 lines (32 loc) · 1.12 KB
/
utils
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
# List tags in facebook/nuclide repository
# https://developer.github.com/v3/repos/#list-tags
tags () {
if [[ -n "$GITHUB_OAUTH_TOKEN" ]]; then
# Avoid GitHub API rate limit
# https://developer.github.com/v3/#rate-limiting
curl -H "Authorization: token ${GITHUB_OAUTH_TOKEN}" -s https://api.github.com/repos/facebook/nuclide/tags 2>/dev/null
else
# Fallback when GitHub OAUTH token is not present
curl -s https://api.github.com/repos/facebook/nuclide/tags 2>/dev/null
fi
}
# Get the latest stable (non "rc") tag and remove the trailing version flag "v"
latestTag () {
tags | jq .[].name | sort -r | grep -v rc | head -n1 | tr -d v\"
}
# Status header for cosmetics purposes
status () {
echo ""
echo "==================================================================="
echo " $@"
echo "==================================================================="
}
# Simple message for cosmetics purposes
msg () {
echo " --> $@"
}
# Run arguments in IMAGE_NAME:IMAGE_TAG container and remove it at exit
run () {
docker run --rm "$IMAGE_NAME:$IMAGE_TAG" "$@"
}