This repository was archived by the owner on May 20, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -176,7 +176,7 @@ pub type BoE = LoE<bool>;
176
176
/// This only appears internally, as an intermediate type for `scalar_or_vector`.
177
177
#[ derive( Debug , Deserialize , PartialEq ) ]
178
178
#[ serde( untagged) ]
179
- pub ( crate ) enum SoV < T > {
179
+ enum SoV < T > {
180
180
One ( T ) ,
181
181
Many ( Vec < T > ) ,
182
182
}
@@ -198,6 +198,32 @@ where
198
198
SoV :: deserialize ( de) . map ( Into :: into)
199
199
}
200
200
201
+ /// A bool or string. This is useful for cases where GitHub Actions contextually
202
+ /// reinterprets a YAML boolean as a string, e.g. `run: true` really means
203
+ /// `run: 'true'`.
204
+ #[ derive( Debug , Deserialize , PartialEq ) ]
205
+ #[ serde( untagged) ]
206
+ enum BoS {
207
+ Bool ( bool ) ,
208
+ String ( String ) ,
209
+ }
210
+
211
+ impl From < BoS > for String {
212
+ fn from ( value : BoS ) -> Self {
213
+ match value {
214
+ BoS :: Bool ( b) => b. to_string ( ) ,
215
+ BoS :: String ( s) => s,
216
+ }
217
+ }
218
+ }
219
+
220
+ pub ( crate ) fn bool_is_string < ' de , D > ( de : D ) -> Result < String , D :: Error >
221
+ where
222
+ D : Deserializer < ' de > ,
223
+ {
224
+ BoS :: deserialize ( de) . map ( Into :: into)
225
+ }
226
+
201
227
#[ cfg( test) ]
202
228
mod tests {
203
229
use std:: collections:: HashMap ;
Original file line number Diff line number Diff line change @@ -81,6 +81,7 @@ pub enum StepBody {
81
81
with : Env ,
82
82
} ,
83
83
Run {
84
+ #[ serde( deserialize_with = "crate::common::bool_is_string" ) ]
84
85
run : String ,
85
86
working_directory : Option < String > ,
86
87
shell : Option < String > ,
You can’t perform that action at this time.
0 commit comments