Skip to content

Commit 5df6772

Browse files
Merge pull request #1710 from ehuss/docs-force-update
Fix docs-update creating merge commits
2 parents 82073e7 + 3878a49 commit 5df6772

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/handlers/docs_update.rs

+7-9
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,17 @@ pub async fn handle_job() -> Result<()> {
6464

6565
pub async fn docs_update() -> Result<Option<Issue>> {
6666
let gh = GithubClient::new_with_default_token(Client::new());
67+
let dest_repo = gh.repository(DEST_REPO).await?;
6768
let work_repo = gh.repository(WORK_REPO).await?;
68-
work_repo
69-
.merge_upstream(&gh, &work_repo.default_branch)
70-
.await?;
7169

7270
let updates = get_submodule_updates(&gh, &work_repo).await?;
7371
if updates.is_empty() {
7472
tracing::trace!("no updates this week?");
7573
return Ok(None);
7674
}
7775

78-
create_commit(&gh, &work_repo, &updates).await?;
79-
Ok(Some(create_pr(&gh, &updates).await?))
76+
create_commit(&gh, &dest_repo, &work_repo, &updates).await?;
77+
Ok(Some(create_pr(&gh, &dest_repo, &updates).await?))
8078
}
8179

8280
struct Update {
@@ -158,11 +156,12 @@ async fn generate_pr_body(
158156

159157
async fn create_commit(
160158
gh: &GithubClient,
159+
dest_repo: &Repository,
161160
rust_repo: &Repository,
162161
updates: &[Update],
163162
) -> Result<()> {
164-
let master_ref = rust_repo
165-
.get_reference(gh, &format!("heads/{}", rust_repo.default_branch))
163+
let master_ref = dest_repo
164+
.get_reference(gh, &format!("heads/{}", dest_repo.default_branch))
166165
.await?;
167166
let master_commit = rust_repo.git_commit(gh, &master_ref.object.sha).await?;
168167
let tree_entries: Vec<_> = updates
@@ -186,8 +185,7 @@ async fn create_commit(
186185
Ok(())
187186
}
188187

189-
async fn create_pr(gh: &GithubClient, updates: &[Update]) -> Result<Issue> {
190-
let dest_repo = gh.repository(DEST_REPO).await?;
188+
async fn create_pr(gh: &GithubClient, dest_repo: &Repository, updates: &[Update]) -> Result<Issue> {
191189
let mut body = String::new();
192190
for update in updates {
193191
write!(body, "{}\n", update.pr_body).unwrap();

0 commit comments

Comments
 (0)