Skip to content

Commit

Permalink
update to chronus' prepare auto release code (#2559)
Browse files Browse the repository at this point in the history
  • Loading branch information
iscai-msft authored Apr 29, 2024
1 parent 4dec7e1 commit 51ddf31
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 23 deletions.
47 changes: 47 additions & 0 deletions eng/prepare-release-branch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
const stdout = execSync(`git status --porcelain`).toString();

if (stdout.trim() !== "") {
console.log("Commiting the following changes:\n", stdout);

execSync(`git add -A`);
execSync(`git -c [email protected] -c user.name="Auto Chronus Bot" commit -am "Bump versions"`);
execSync(`git push origin HEAD:${branchName} --force`);

console.log();
console.log("-".repeat(160));
console.log("| Link to create the PR");
console.log(`| https://github.com/timotheeguerin/chronus/pull/new/${branchName} `);
console.log("-".repeat(160));

const github = getOctokit(process.env.GITHUB_TOKEN ?? "");
const prs = await github.rest.pulls.list({
...context.repo,
head: `${context.repo.owner}:${branchName}`,
base: "main",
state: "open",
});
console.log(
"Found those prs",
prs.url,
prs.data.map((x) => x.head.ref),
);
const existing = prs.data[0];
if (existing) {
console.log("Existing, updating pr", existing.number);
await github.rest.pulls.update({
...context.repo,
pull_number: existing.number,
body: changeStatus,
});
} else {
await github.rest.pulls.create({
...context.repo,
title: "Release changes",
head: branchName,
base: "main",
body: changeStatus,
});
}
} else {
console.log("No changes to publish");
}
23 changes: 0 additions & 23 deletions eng/publish.mjs

This file was deleted.

0 comments on commit 51ddf31

Please sign in to comment.