Co-authored-by: iscai-msft <isabellavcai@gmail.com>
This commit is contained in:
iscai-msft 2024-05-23 16:04:15 -04:00 коммит произвёл GitHub
Родитель e748eecb74
Коммит 915d446f64
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
4 изменённых файлов: 60 добавлений и 1 удалений

Просмотреть файл

@ -31,6 +31,6 @@ jobs:
name: Install dependencies
- name: Create release branch
run: node ./eng/prepare-release-branch.js
run: node ./eng/prepare-release-branch.mjs
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

Просмотреть файл

@ -0,0 +1,55 @@
/* eslint-disable no-console */
/* eslint-disable no-undef */
// @ts-check
import { context, getOctokit } from "@actions/github";
import { execSync } from "child_process";
const branchName = "publish/auto-release";
execSync(`pnpm change version`, { stdio: "inherit" });
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 user.email=chronus@github.com -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/Azure/autorest.python/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: "",
});
} else {
await github.rest.pulls.create({
...context.repo,
title: "Release changes",
head: branchName,
base: "main",
body: "",
});
}
} else {
console.log("No changes to publish");
}

Просмотреть файл

@ -35,6 +35,7 @@
"homepage": "https://github.com/Azure/autorest.python#readme",
"devDependencies": {
"@azure-tools/cadl-ranch": "~0.12.7",
"@actions/github": "6.0.0",
"@chronus/chronus": "^0.10.1",
"@chronus/github": "^0.3.2",
"@typespec/prettier-plugin-typespec": "~0.55.0",

Просмотреть файл

@ -8,6 +8,9 @@ importers:
.:
devDependencies:
'@actions/github':
specifier: 6.0.0
version: 6.0.0
'@azure-tools/cadl-ranch':
specifier: ~0.12.7
version: 0.12.7(@typespec/versioning@0.55.0)