Skip to content

Commit eabf453

Browse files
committed
fix: Correctly deserialize the renaming of branch worflow kind
Deserialize the branch rename workflow correctly
1 parent 2245ab5 commit eabf453

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

crates/but-action/src/workflow.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@ pub enum Kind {
3636
#[serde(untagged)]
3737
enum KindCompat {
3838
String(String),
39-
KindObj {
39+
KindRenameBranchObj {
40+
#[serde(rename = "type")]
41+
kind_type: String,
42+
subject: RenameBranchOutcome,
43+
},
44+
KindRewordObj {
4045
#[serde(rename = "type")]
4146
kind_type: String,
4247
#[serde(default)]
@@ -51,11 +56,17 @@ impl<'de> Deserialize<'de> for Kind {
5156
{
5257
match KindCompat::deserialize(deserializer)? {
5358
KindCompat::String(s) if s == "Reword" => Ok(Kind::Reword(None)),
54-
KindCompat::KindObj { kind_type, subject }
59+
KindCompat::KindRewordObj { kind_type, subject }
5560
if kind_type == "reword" || kind_type == "Reword" =>
5661
{
5762
Ok(Kind::Reword(subject))
5863
}
64+
KindCompat::KindRenameBranchObj { kind_type, subject }
65+
if kind_type == "renameBranch" || kind_type == "RenameBranch" =>
66+
{
67+
Ok(Kind::RenameBranch(subject))
68+
}
69+
5970
_ => Err(serde::de::Error::custom("Unknown Kind variant")),
6071
}
6172
}

0 commit comments

Comments
 (0)