Skip to content
Closed
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
16 changes: 10 additions & 6 deletions .github/local-actions/branch-manager/lib/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
} from '../../../../github-actions/utils.js';
import {MergeConflictsFatalError} from '../../../../ng-dev/pr/merge/failures.js';
import {createPullRequestValidationConfig} from '../../../../ng-dev/pr/common/validation/validation-config.js';
import {InvalidTargetLabelError} from '../../../../ng-dev/pr/common/targeting/target-label.js';

interface CommmitStatus {
state: 'pending' | 'error' | 'failure' | 'success';
Expand Down Expand Up @@ -155,19 +156,22 @@ async function main() {

await setMergeabilityStatusOnPullRequest(statusInfo);
} catch (e: Error | unknown) {
let state: CommmitStatus['state'] = 'error';
let description: string;
const {runId, repo, serverUrl} = actionContext;
const targetUrl = `${serverUrl}/${repo.owner}/${repo.repo}/actions/runs/${runId}`;
if (e instanceof Error) {

if (e instanceof InvalidTargetLabelError) {
// For this action, an invalid target label represents that we aren't ready to check the
// mergeability yet, rather than an actual failure.
state = 'pending';
description = e.failureMessage;
} else if (e instanceof Error) {
description = e.message;
} else {
description = 'Internal Error, see link for action log';
}
await setMergeabilityStatusOnPullRequest({
state: 'error',
description,
targetUrl,
});
await setMergeabilityStatusOnPullRequest({state, description, targetUrl});
// Re-throw the error so that the action run is set as failing.
throw e;
}
Expand Down
12 changes: 6 additions & 6 deletions .github/local-actions/branch-manager/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -69642,19 +69642,19 @@ async function main() {
})();
await setMergeabilityStatusOnPullRequest(statusInfo);
} catch (e) {
let state = "error";
let description;
const { runId, repo: repo2, serverUrl } = import_github5.context;
const targetUrl = `${serverUrl}/${repo2.owner}/${repo2.repo}/actions/runs/${runId}`;
if (e instanceof Error) {
if (e instanceof InvalidTargetLabelError) {
state = "pending";
description = e.failureMessage;
} else if (e instanceof Error) {
description = e.message;
} else {
description = "Internal Error, see link for action log";
}
await setMergeabilityStatusOnPullRequest({
state: "error",
description,
targetUrl
});
await setMergeabilityStatusOnPullRequest({ state, description, targetUrl });
throw e;
}
}
Expand Down
2 changes: 1 addition & 1 deletion github-actions/branch-manager/lib/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ async function createWorkflowForPullRequest(inputs: WorkflowInputs) {
repo: inputs.repo,
owner: inputs.owner,
state: 'pending',
description: 'Running mergibility check',
description: 'Mergibility check requested',
sha: inputs.sha,
context: 'mergeability',
});
Expand Down
2 changes: 1 addition & 1 deletion github-actions/branch-manager/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -48159,7 +48159,7 @@ async function createWorkflowForPullRequest(inputs) {
repo: inputs.repo,
owner: inputs.owner,
state: "pending",
description: "Running mergibility check",
description: "Mergibility check requested",
sha: inputs.sha,
context: "mergeability"
});
Expand Down