Browse Source

Fix finding the git commit message

Previously we were looking for a non-existent field, which meant that the PR
number parsing was always failing.
Mark Rousskov 2 years ago
parent
commit
a2ae093f52
2 changed files with 2 additions and 3 deletions
  1. 1 2
      src/github.rs
  2. 1 1
      src/handlers/rustc_commits.rs

+ 1 - 2
src/github.rs

@@ -1455,8 +1455,6 @@ impl GithubClient {
 #[derive(Debug, serde::Deserialize)]
 pub struct GithubCommit {
     pub sha: String,
-    #[serde(default)]
-    pub message: String,
     pub commit: GitCommit,
     pub parents: Vec<Parent>,
 }
@@ -1464,6 +1462,7 @@ pub struct GithubCommit {
 #[derive(Debug, serde::Deserialize)]
 pub struct GitCommit {
     pub author: GitUser,
+    pub message: String,
 }
 
 #[derive(Debug, serde::Deserialize)]

+ 1 - 1
src/handlers/rustc_commits.rs

@@ -100,7 +100,7 @@ async fn synchronize_commits(ctx: &Context, sha: &str, pr: u32) {
         let parent_sha = gc.parents.remove(0).sha;
 
         if pr.is_none() {
-            if let Some(tail) = gc.message.strip_prefix("Auto merge of #") {
+            if let Some(tail) = gc.commit.message.strip_prefix("Auto merge of #") {
                 if let Some(end) = tail.find(' ') {
                     if let Ok(number) = tail[..end].parse::<u32>() {
                         pr = Some(number);