Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions .github/local-actions/branch-manager/main.js

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions ng-dev/pr/common/fetch-pull-request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,19 +249,17 @@ export function getStatusesForPullRequest(
.forEach((context) => {
switch (context.__typename) {
case 'CheckRun':
statusMap.set(`check:${context.name}`, {
statusMap.set(context.name, {
type: 'check' as const,
name: context.name,
status: normalizeGithubCheckState(context.conclusion, context.status),
});
break;
case 'StatusContext':
Comment thread
alan-agius4 marked this conversation as resolved.
statusMap.set(`status:${context.context!}`, {
statusMap.set(context.context!, {
type: 'status' as const,
name: context.context!,
status: normalizeGithubStatusState(context.state!),
});
break;
}
});

Expand Down
87 changes: 1 addition & 86 deletions ng-dev/pr/common/test/common.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@ import {GoogleSyncConfig} from '../../../utils/g3-sync-config.js';
import {targetLabels} from '../labels/target.js';
import {Log} from '../../../utils/logging.js';

import {
getStatusesForPullRequest,
PullRequestFromGithub,
PullRequestStatus,
} from '../fetch-pull-request.js';
import {PullRequestFromGithub} from '../fetch-pull-request.js';
import {mergeLabels} from '../labels/merge.js';
import {requiresLabels} from '../labels/requires.js';

Expand Down Expand Up @@ -94,87 +90,6 @@ describe('pull request validation', () => {
return configFileName;
}

describe('assert-signed-cla', () => {
it('should pass when cla/google commit status is passing', async () => {
const config = createIsolatedValidationConfig({assertSignedCla: true});
const pr = createTestPullRequest();
pr.commits.nodes[1].commit.statusCheckRollup = {
state: 'SUCCESS',
contexts: {
nodes: [
{
__typename: 'StatusContext',
context: 'cla/google',
state: 'SUCCESS',
createdAt: '2026-07-13T10:00:00Z',
} as any,
],
},
};

const results = await assertValidPullRequest(pr, config, ngDevConfig, null, prTarget, git);
expect(results.length).toBe(0);
});

it('should fail when only a CheckRun named cla/google is passing', async () => {
const config = createIsolatedValidationConfig({assertSignedCla: true});
const pr = createTestPullRequest();
pr.commits.nodes[1].commit.statusCheckRollup = {
state: 'SUCCESS',
contexts: {
nodes: [
{
__typename: 'CheckRun',
name: 'cla/google',
status: 'COMPLETED',
conclusion: 'SUCCESS',
completedAt: '2026-07-13T10:05:00Z',
} as any,
],
},
};

const results = await assertValidPullRequest(pr, config, ngDevConfig, null, prTarget, git);
expect(results.length).toBe(1);
expect(results[0].message).toBe('CLA is not signed by the contributor.');
});

it('should not allow a passing CheckRun named cla/google to overwrite a failing StatusContext', async () => {
const config = createIsolatedValidationConfig({assertSignedCla: true});
const pr = createTestPullRequest();
pr.commits.nodes[1].commit.statusCheckRollup = {
state: 'FAILURE',
contexts: {
nodes: [
{
__typename: 'StatusContext',
context: 'cla/google',
state: 'FAILURE',
createdAt: '2026-07-13T10:00:00Z',
} as any,
{
__typename: 'CheckRun',
name: 'cla/google',
status: 'COMPLETED',
conclusion: 'SUCCESS',
completedAt: '2026-07-13T10:05:00Z',
} as any,
],
},
};

const {statuses} = getStatusesForPullRequest(pr);
expect(statuses).toEqual([
{type: 'status', name: 'cla/google', status: PullRequestStatus.FAILING},
{type: 'check', name: 'cla/google', status: PullRequestStatus.PASSING},
]);

const results = await assertValidPullRequest(pr, config, ngDevConfig, null, prTarget, git);
expect(results.length).toBe(1);
expect(results[0].message).toBe('CLA is not signed by the contributor.');
});
});

describe('assert-allowed-target-label', () => {
const fakeReleaseTrains = {isFeatureFreeze: () => false} as any;

Expand Down
4 changes: 2 additions & 2 deletions ng-dev/pr/common/validation/assert-signed-cla.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export const signedClaValidation = createPullRequestValidation(

class Validation extends PullRequestValidation {
assert(pullRequest: PullRequestFromGithub) {
const passing = getStatusesForPullRequest(pullRequest).statuses.some(({type, name, status}) => {
return type === 'status' && name === 'cla/google' && status === PullRequestStatus.PASSING;
const passing = getStatusesForPullRequest(pullRequest).statuses.some(({name, status}) => {
return name === 'cla/google' && status === PullRequestStatus.PASSING;
});

if (!passing) {
Expand Down
Loading