You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
all: use basic auth instead of token auth in querystring
Port the Client implementation to use github.com/kevinburke/rest,
which gives us inspection of the HTTP request/response, user agents
and basic auth out of the box, without needing to set those every
time. Most of the rest of the code remains the same.
Move the VERSION constant into the github subpackage (from the main
package) so we can use it there.
Fixes#95.
Fixes#97.
Copy file name to clipboardExpand all lines: github-release.go
+37-24Lines changed: 37 additions & 24 deletions
Original file line number
Diff line number
Diff line change
@@ -18,22 +18,24 @@ type Options struct {
18
18
19
19
goptions.Verbs
20
20
Downloadstruct {
21
-
Tokenstring`goptions:"-s, --security-token, description='Github token ($GITHUB_TOKEN if set). required if repo is private.'"`
22
-
Userstring`goptions:"-u, --user, description='Github repo user or organisation (required if $GITHUB_USER not set)'"`
23
-
Repostring`goptions:"-r, --repo, description='Github repo (required if $GITHUB_REPO not set)'"`
24
-
Latestbool`goptions:"-l, --latest, description='Download latest release (required if tag is not specified)',mutexgroup='input'"`
25
-
Tagstring`goptions:"-t, --tag, description='Git tag to download from (required if latest is not specified)', mutexgroup='input',obligatory"`
26
-
Namestring`goptions:"-n, --name, description='Name of the file', obligatory"`
21
+
Tokenstring`goptions:"-s, --security-token, description='Github token ($GITHUB_TOKEN if set). required if repo is private.'"`
22
+
Userstring`goptions:"-u, --user, description='Github repo user or organisation (required if $GITHUB_USER not set)'"`
23
+
AuthUserstring`goptions:"-a, --auth-user, description='Username for authenticating to the API (falls back to $GITHUB_AUTH_USER or $GITHUB_USER)'"`
24
+
Repostring`goptions:"-r, --repo, description='Github repo (required if $GITHUB_REPO not set)'"`
25
+
Latestbool`goptions:"-l, --latest, description='Download latest release (required if tag is not specified)',mutexgroup='input'"`
26
+
Tagstring`goptions:"-t, --tag, description='Git tag to download from (required if latest is not specified)', mutexgroup='input',obligatory"`
27
+
Namestring`goptions:"-n, --name, description='Name of the file', obligatory"`
27
28
} `goptions:"download"`
28
29
Uploadstruct {
29
-
Tokenstring`goptions:"-s, --security-token, description='Github token (required if $GITHUB_TOKEN not set)'"`
30
-
Userstring`goptions:"-u, --user, description='Github repo user or organisation (required if $GITHUB_USER not set)'"`
31
-
Repostring`goptions:"-r, --repo, description='Github repo (required if $GITHUB_REPO not set)'"`
32
-
Tagstring`goptions:"-t, --tag, description='Git tag to upload to', obligatory"`
33
-
Namestring`goptions:"-n, --name, description='Name of the file', obligatory"`
34
-
Labelstring`goptions:"-l, --label, description='Label (description) of the file'"`
35
-
File*os.File`goptions:"-f, --file, description='File to upload (use - for stdin)', rdonly, obligatory"`
36
-
Replacebool`goptions:"-R, --replace, description='Replace asset with same name if it already exists (WARNING: not atomic, failure to upload will remove the original asset too)'"`
30
+
Tokenstring`goptions:"-s, --security-token, description='Github token (required if $GITHUB_TOKEN not set)'"`
31
+
Userstring`goptions:"-u, --user, description='Github repo user or organisation (required if $GITHUB_USER not set)'"`
32
+
AuthUserstring`goptions:"-a, --auth-user, description='Username for authenticating to the API (falls back to $GITHUB_AUTH_USER or $GITHUB_USER)'"`
33
+
Repostring`goptions:"-r, --repo, description='Github repo (required if $GITHUB_REPO not set)'"`
34
+
Tagstring`goptions:"-t, --tag, description='Git tag to upload to', obligatory"`
35
+
Namestring`goptions:"-n, --name, description='Name of the file', obligatory"`
36
+
Labelstring`goptions:"-l, --label, description='Label (description) of the file'"`
37
+
File*os.File`goptions:"-f, --file, description='File to upload (use - for stdin)', rdonly, obligatory"`
38
+
Replacebool`goptions:"-R, --replace, description='Replace asset with same name if it already exists (WARNING: not atomic, failure to upload will remove the original asset too)'"`
37
39
} `goptions:"upload"`
38
40
Releasestruct {
39
41
Tokenstring`goptions:"-s, --security-token, description='Github token (required if $GITHUB_TOKEN not set)'"`
@@ -49,6 +51,7 @@ type Options struct {
49
51
Editstruct {
50
52
Tokenstring`goptions:"-s, --security-token, description='Github token (required if $GITHUB_TOKEN not set)'"`
51
53
Userstring`goptions:"-u, --user, description='Github repo user or organisation (required if $GITHUB_USER not set)'"`
54
+
AuthUserstring`goptions:"-a, --auth-user, description='Username for authenticating to the API (falls back to $GITHUB_AUTH_USER or $GITHUB_USER)'"`
52
55
Repostring`goptions:"-r, --repo, description='Github repo (required if $GITHUB_REPO not set)'"`
53
56
Tagstring`goptions:"-t, --tag, obligatory, description='Git tag to edit the release of'"`
54
57
Namestring`goptions:"-n, --name, description='New name of the release (defaults to tag)'"`
@@ -57,17 +60,19 @@ type Options struct {
57
60
Prereleasebool`goptions:"-p, --pre-release, description='The release is a pre-release'"`
58
61
} `goptions:"edit"`
59
62
Deletestruct {
60
-
Tokenstring`goptions:"-s, --security-token, description='Github token (required if $GITHUB_TOKEN not set)'"`
61
-
Userstring`goptions:"-u, --user, description='Github repo user or organisation (required if $GITHUB_USER not set)'"`
62
-
Repostring`goptions:"-r, --repo, description='Github repo (required if $GITHUB_REPO not set)'"`
63
-
Tagstring`goptions:"-t, --tag, obligatory, description='Git tag of release to delete'"`
63
+
Tokenstring`goptions:"-s, --security-token, description='Github token (required if $GITHUB_TOKEN not set)'"`
64
+
Userstring`goptions:"-u, --user, description='Github repo user or organisation (required if $GITHUB_USER not set)'"`
65
+
AuthUserstring`goptions:"-a, --auth-user, description='Username for authenticating to the API (falls back to $GITHUB_AUTH_USER or $GITHUB_USER)'"`
66
+
Repostring`goptions:"-r, --repo, description='Github repo (required if $GITHUB_REPO not set)'"`
67
+
Tagstring`goptions:"-t, --tag, obligatory, description='Git tag of release to delete'"`
64
68
} `goptions:"delete"`
65
69
Infostruct {
66
-
Tokenstring`goptions:"-s, --security-token, description='Github token ($GITHUB_TOKEN if set). required if repo is private.'"`
67
-
Userstring`goptions:"-u, --user, description='Github repo user or organisation (required if $GITHUB_USER not set)'"`
68
-
Repostring`goptions:"-r, --repo, description='Github repo (required if $GITHUB_REPO not set)'"`
69
-
Tagstring`goptions:"-t, --tag, description='Git tag to query (optional)'"`
70
-
JSONbool`goptions:"-j, --json, description='Emit info as JSON instead of text'"`
70
+
Tokenstring`goptions:"-s, --security-token, description='Github token ($GITHUB_TOKEN if set). required if repo is private.'"`
71
+
Userstring`goptions:"-u, --user, description='Github repo user or organisation (required if $GITHUB_USER not set)'"`
72
+
AuthUserstring`goptions:"-a, --auth-user, description='Username for authenticating to the API (falls back to $GITHUB_AUTH_USER or $GITHUB_USER)'"`
73
+
Repostring`goptions:"-r, --repo, description='Github repo (required if $GITHUB_REPO not set)'"`
74
+
Tagstring`goptions:"-t, --tag, description='Git tag to query (optional)'"`
75
+
JSONbool`goptions:"-j, --json, description='Emit info as JSON instead of text'"`
71
76
} `goptions:"info"`
72
77
}
73
78
@@ -87,6 +92,9 @@ var (
87
92
)
88
93
89
94
var (
95
+
// The user whose token is being used to authenticate to the API. If unset,
0 commit comments