File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -24,10 +24,10 @@ USAGE
24
24
FNAME=" ${1:- } "
25
25
if [[ -f " $FNAME " ]]; then
26
26
CONTENT=$( cat " $FNAME " )
27
- GITHUB_USERNAME =" ${2:- } "
27
+ GITHUB_TOKEN =" ${2:- } "
28
28
else
29
29
CONTENT=$( timeout 2 cat -)
30
- GITHUB_USERNAME =" ${1-} "
30
+ GITHUB_TOKEN =" ${1-} "
31
31
FNAME=" stdin"
32
32
if [[ " $CONTENT " == " " ]]; then
33
33
print_usage
36
36
fi
37
37
38
38
# Github does not permit anonymous uploads since April 2018
39
- if [[ -z $GITHUB_USERNAME ]]; then
39
+ if [[ -z $GITHUB_TOKEN ]]; then
40
40
print_usage
41
41
exit 2
42
42
fi
@@ -68,7 +68,7 @@ cat > $tmp_file <<EOF
68
68
EOF
69
69
70
70
# 4. Use curl to make a POST request
71
- OUTPUT=$( curl -u ${GITHUB_USERNAME} -X POST -d @$tmp_file " https://api.github.com/gists" )
71
+ OUTPUT=$( curl -H " Authorization: token ${GITHUB_TOKEN} " -X POST -d @$tmp_file " https://api.github.com/gists" )
72
72
uploaded_url=$( echo " $OUTPUT " | grep ' html_url' | grep ' gist' )
73
73
74
74
# 5. cleanup the tmp file
You can’t perform that action at this time.
0 commit comments