* fix issue

* add changelog

* update

Co-authored-by: jianyexi <jianyxi@microsoft.com>
This commit is contained in:
JianyeXi 2020-10-12 10:59:35 +08:00 коммит произвёл GitHub
Родитель a08657ebff
Коммит 3d8ad18b02
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 21 добавлений и 15 удалений

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

@ -1,5 +1,9 @@
# Changelog
## 0.13.3
- Fix bug: breaking change script will fail to run when target branch is not master branch , it's casued by the version of cross api version breaking change .
## 0.13.2
- Let unified pipeline show message of catched error for model validation and semantic validation.

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

@ -1,6 +1,6 @@
{
"name": "@azure/rest-api-specs-scripts",
"version": "0.13.2",
"version": "0.13.3",
"description": "Scripts for the Azure RestAPI specification repository 'azure-rest-api-specs'.",
"types": "dist/index.d.ts",
"main": "dist/index.js",

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

@ -330,7 +330,7 @@ export class CrossVersionBreakingDetector {
}
export async function runCrossVersionBreakingChangeDetection(type:SwaggerVersionType = "stable") {
const pr = await devOps.createPullRequestProperties(cli.defaultConfig());
const pr = await buildPRObject();;
console.log(`PR target branch is ${pr ? pr.targetBranch : ""}`);
let swaggersToProcess = await utils.getFilesChangedInPR(pr);
@ -359,25 +359,27 @@ export async function runCrossVersionBreakingChangeDetection(type:SwaggerVersion
}
}
/**
* NOTE: For base branch which not in targetBranches, the breaking change tool compare head branch with master branch.
* TargetBranches is a set of branches and treat each of them like a service team master branch.
*/
const targetBranches = ["master", "RPSaaSDev", "RPSaaSMaster"];
function changeTargetBranch(pr: devOps.PullRequestProperties | undefined) {
/**
* NOTE: For base branch which not in targetBranches, the breaking change tool compare head branch with master branch.
* TargetBranches is a set of branches and treat each of them like a service team master branch.
*/
const targetBranches = ["master", "RPSaaSDev", "RPSaaSMaster"];
const buildPRObject = async ()=> {
/**
* For PR target branch not in `targetBranches`. prepare for switch to master branch,
* if not the switching to master below would failed
*/
if (
!targetBranches.includes(
* For PR target branch not in `targetBranches`. prepare for switch to master branch,
* if not the switching to master below would failed
*/
if (!targetBranches.includes(
cli.defaultConfig().env.SYSTEM_PULLREQUEST_TARGETBRANCH!
)
) {
utils.setUpstreamBranch("master", "remotes/origin/master");
}
return await devOps.createPullRequestProperties(cli.defaultConfig());
}
function changeTargetBranch(pr: devOps.PullRequestProperties | undefined) {
/*
* always compare against master
* we still use the changed files got from the PR, because the master branch may quite different with the PR target branch
@ -394,7 +396,7 @@ export async function runScript() {
// Used to enable running script outside TravisCI for debugging
const isRunningInTravisCI = process.env.TRAVIS === "true";
// create Azure DevOps PR properties.
const pr = await devOps.createPullRequestProperties(cli.defaultConfig());
const pr = await buildPRObject();
console.log(`PR target branch is ${pr ? pr.targetBranch : ""}`);
let targetBranch = utils.getTargetBranch();