File tree Expand file tree Collapse file tree 3 files changed +9
-4
lines changed Expand file tree Collapse file tree 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 {
100100 "Accept" ,
101101 HeaderValue :: from_str ( "application/vnd.github.raw+json" ) ?,
102102 ) ;
103- // headers.insert("User-Agent", USER_AGENT.parse().unwrap());
104103 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 ( ) ) ?;
106106 val. set_sensitive ( true ) ;
107107 headers. insert ( AUTHORIZATION , val) ;
108108 }
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ use crate::{
1515 clang_tools:: { clang_format:: summarize_style, ReviewComments } ,
1616 cli:: FeedbackInput ,
1717 common_fs:: FileObj ,
18- rest_api:: { RestApiRateLimitHeaders , COMMENT_MARKER } ,
18+ rest_api:: { RestApiRateLimitHeaders , COMMENT_MARKER , USER_AGENT } ,
1919} ;
2020
2121use super :: {
@@ -58,6 +58,7 @@ impl GithubApiClient {
5858 Ok ( GithubApiClient {
5959 client : Client :: builder ( )
6060 . default_headers ( Self :: make_headers ( ) ?)
61+ . user_agent ( USER_AGENT )
6162 . build ( )
6263 . with_context ( || "Failed to create a session client for REST API calls" ) ?,
6364 pull_request,
Original file line number Diff line number Diff line change @@ -22,7 +22,11 @@ use crate::cli::FeedbackInput;
2222use crate :: common_fs:: { FileFilter , FileObj } ;
2323
2424pub 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" ) ) ;
2630
2731/// A structure to contain the different forms of headers that
2832/// describe a REST API's rate limit status.
You can’t perform that action at this time.
0 commit comments