File tree 3 files changed +16
-7
lines changed 3 files changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ pub fn get_arg_parser() -> Command {
13
13
Arg :: new ( "verbosity" )
14
14
. long ( "verbosity" )
15
15
. short ( 'v' )
16
- . default_value ( "debug " )
16
+ . default_value ( "info " )
17
17
. value_parser ( [ "debug" , "info" ] )
18
18
. long_help (
19
19
"This controls the action's verbosity in the workflow's logs.
Original file line number Diff line number Diff line change @@ -38,6 +38,9 @@ pub struct GithubApiClient {
38
38
39
39
/// The value of the `GITHUB_SHA` environment variable.
40
40
sha : Option < String > ,
41
+
42
+ /// The value of the `ACTIONS_STEP_DEBUG` environment variable.
43
+ pub debug_enabled : bool ,
41
44
}
42
45
43
46
impl Default for GithubApiClient {
@@ -77,9 +80,15 @@ impl GithubApiClient {
77
80
} else {
78
81
None
79
82
} ,
83
+ debug_enabled : match env:: var ( "ACTIONS_STEP_DEBUG" ) {
84
+ Ok ( val) => val == "true" ,
85
+ Err ( _) => false ,
86
+ } ,
80
87
}
81
88
}
82
89
}
90
+
91
+ // implement the RestApiClient trait for the GithubApiClient
83
92
impl RestApiClient for GithubApiClient {
84
93
fn set_exit_code (
85
94
& self ,
Original file line number Diff line number Diff line change @@ -38,12 +38,6 @@ pub fn main(args: Vec<String>) -> i32 {
38
38
let args = arg_parser. get_matches_from ( args) ;
39
39
40
40
logger:: init ( ) . unwrap ( ) ;
41
- let verbosity = args. get_one :: < String > ( "verbosity" ) . unwrap ( ) . as_str ( ) == "debug" ;
42
- set_max_level ( if verbosity {
43
- LevelFilter :: Debug
44
- } else {
45
- LevelFilter :: Info
46
- } ) ;
47
41
48
42
let root_path = args. get_one :: < String > ( "repo-root" ) . unwrap ( ) ;
49
43
if root_path != & String :: from ( "." ) {
@@ -61,6 +55,12 @@ pub fn main(args: Vec<String>) -> i32 {
61
55
} ;
62
56
63
57
let rest_api_client = GithubApiClient :: new ( ) ;
58
+ let verbosity = args. get_one :: < String > ( "verbosity" ) . unwrap ( ) . as_str ( ) == "debug" ;
59
+ set_max_level ( if verbosity || rest_api_client. debug_enabled {
60
+ LevelFilter :: Debug
61
+ } else {
62
+ LevelFilter :: Info
63
+ } ) ;
64
64
log:: info!( "Processing event {}" , rest_api_client. event_name) ;
65
65
66
66
let extensions = args
You can’t perform that action at this time.
0 commit comments