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: 10 additions & 2 deletions .github/local-actions/branch-manager/main.js

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions ng-dev/pr/merge/merge-pull-request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,19 @@ export async function mergePullRequest(prNumber: number, flags: PullRequestMerge
Log.warn(`You can generate a token here: ${GITHUB_TOKEN_GENERATE_URL}`);
return false;
}
// Catch errors to the Github API for repository rule violations. We want to
// exit the script with a better explanation of the error.
if (
isGithubApiError(e) &&
e.status === 405 &&
e.message.startsWith('Repository rule violations found')
) {
Log.error(' ✘ Repository Rule Violation. This typically indicates that you are not');
Log.error(' currently a member of the expected group for merge permissions in this');
Log.error(' repository. Have you been placed in the expected caretaking group?');
Log.debug('Github API request failed: ' + bold(e.message));
return false;
}
if (isGithubApiError(e)) {
Log.error('Github API request failed: ' + bold(e.message));
return false;
Expand Down
13 changes: 12 additions & 1 deletion ng-dev/utils/git/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {Octokit} from '@octokit/rest';
import {RequestParameters} from '@octokit/types';
import {RequestError} from '@octokit/request-error';
import {query} from 'typed-graphqlify';
import {Log} from '../logging';

/**
* An object representation of a Graphql Query to be used as a response type and
Expand All @@ -30,7 +31,17 @@ export interface GithubRepo {
/** A Github client for interacting with the Github APIs. */
export class GithubClient {
/** The octokit instance actually performing API requests. */
protected _octokit: Octokit = new Octokit({...this._octokitOptions});
protected _octokit: Octokit = new Octokit({
// Move all default octokit logging into debug. We prefer handle all of the logging exposed
// to user's from Github ourselves.
log: {
debug: Log.debug,
error: Log.debug,
info: Log.debug,
warn: Log.debug,
},
...this._octokitOptions,
});

readonly pulls: Octokit['pulls'] = this._octokit.pulls;
readonly orgs: Octokit['orgs'] = this._octokit.orgs;
Expand Down
Loading