豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Commit 1c1d5c5

Browse files
committed
fix(ng-dev/pr): do not fail assertions for changes for target label when the fixup label is applied (#392)
As noted in #301, if the commit message fixup label is applied we cannot properly assert whether or not the changes are allowed for the target label. Instead we should skip this assertion. Fixes #301 PR Close #392
1 parent ea10bc1 commit 1c1d5c5

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

ng-dev/pr/common/targeting/target-label.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,13 @@ export async function getTargetBranchesForPullRequest(
127127
);
128128
const targetBranches = await getBranchesFromTargetLabel(matchingLabel, githubTargetBranch);
129129

130-
assertChangesAllowForTargetLabel(commits, matchingLabel, config.pullRequest, releaseTrains);
130+
assertChangesAllowForTargetLabel(
131+
commits,
132+
matchingLabel,
133+
config.pullRequest,
134+
releaseTrains,
135+
labelsOnPullRequest,
136+
);
131137

132138
return targetBranches;
133139
} catch (error) {

ng-dev/pr/common/validation/validations.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {Commit} from '../../../commit-message/parse';
1010
import {TargetLabel, TargetLabelName} from '../targeting/target-label';
1111
import {breakingChangeLabel, PullRequestConfig} from '../../config';
1212
import {PullRequestFailure} from './failures';
13-
import {red, warn} from '../../../utils/console';
13+
import {debug, red, warn} from '../../../utils/console';
1414
import {
1515
getStatusesForPullRequest,
1616
PullRequestFromGithub,
@@ -28,7 +28,19 @@ export function assertChangesAllowForTargetLabel(
2828
label: TargetLabel,
2929
config: PullRequestConfig,
3030
releaseTrains: ActiveReleaseTrains,
31+
labelsOnPullRequest: string[],
3132
) {
33+
if (
34+
!!config.commitMessageFixupLabel &&
35+
labelsOnPullRequest.some((name) => matchesPattern(name, config.commitMessageFixupLabel))
36+
) {
37+
debug(
38+
'Skipping commit message target label validation because the commit message fixup label is ' +
39+
'applied.',
40+
);
41+
return;
42+
}
43+
3244
/**
3345
* List of commit scopes which are exempted from target label content requirements. i.e. no `feat`
3446
* scopes in patch branches, no breaking changes in minor or patch changes.

0 commit comments

Comments
 (0)