File tree 3 files changed +9
-4
lines changed
3 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -100,9 +100,9 @@ impl RestApiClient for GithubApiClient {
100
100
"Accept" ,
101
101
HeaderValue :: from_str ( "application/vnd.github.raw+json" ) ?,
102
102
) ;
103
- // headers.insert("User-Agent", USER_AGENT.parse().unwrap());
104
103
if let Ok ( token) = env:: var ( "GITHUB_TOKEN" ) {
105
- let mut val = HeaderValue :: from_str ( token. as_str ( ) ) ?;
104
+ log:: debug!( "Using auth token from GITHUB_TOKEN environment variable" ) ;
105
+ let mut val = HeaderValue :: from_str ( format ! ( "token {token}" ) . as_str ( ) ) ?;
106
106
val. set_sensitive ( true ) ;
107
107
headers. insert ( AUTHORIZATION , val) ;
108
108
}
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ use crate::{
15
15
clang_tools:: { clang_format:: summarize_style, ReviewComments } ,
16
16
cli:: FeedbackInput ,
17
17
common_fs:: FileObj ,
18
- rest_api:: { RestApiRateLimitHeaders , COMMENT_MARKER } ,
18
+ rest_api:: { RestApiRateLimitHeaders , COMMENT_MARKER , USER_AGENT } ,
19
19
} ;
20
20
21
21
use super :: {
@@ -58,6 +58,7 @@ impl GithubApiClient {
58
58
Ok ( GithubApiClient {
59
59
client : Client :: builder ( )
60
60
. default_headers ( Self :: make_headers ( ) ?)
61
+ . user_agent ( USER_AGENT )
61
62
. build ( )
62
63
. with_context ( || "Failed to create a session client for REST API calls" ) ?,
63
64
pull_request,
Original file line number Diff line number Diff line change @@ -22,7 +22,11 @@ use crate::cli::FeedbackInput;
22
22
use crate :: common_fs:: { FileFilter , FileObj } ;
23
23
24
24
pub static COMMENT_MARKER : & str = "<!-- cpp linter action -->\n " ;
25
- pub static USER_OUTREACH : & str = "\n \n Have any feedback or feature suggestions? [Share it here.](https://github.com/cpp-linter/cpp-linter-action/issues)" ;
25
+ pub static USER_OUTREACH : & str = concat ! (
26
+ "\n \n Have any feedback or feature suggestions? [Share it here.]" ,
27
+ "(https://github.com/cpp-linter/cpp-linter-action/issues)"
28
+ ) ;
29
+ pub static USER_AGENT : & str = concat ! ( "cpp-linter/" , env!( "CARGO_PKG_VERSION" ) ) ;
26
30
27
31
/// A structure to contain the different forms of headers that
28
32
/// describe a REST API's rate limit status.
You can’t perform that action at this time.
0 commit comments