Skip to content

Commit

Permalink
fix: fetch GitHub PR author name, fixes #7232 (#7253)
Browse files Browse the repository at this point in the history
Reverts the change to `getPullRequestAuthor` in the GitHub backend from
4f419dd, so that it fetches the PR author's name as before. In the AWS
Cognito GitHub backend, return the GitHub login as the PR author.

Co-authored-by: Martin Jagodic <jagodicmartin1@gmail.com>
  • Loading branch information
domcleal and martinjagodic authored Aug 1, 2024
1 parent 804b3aa commit 0e5335d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import AuthenticationPage from './AuthenticationPage';

import type { GitHubUser } from 'decap-cms-backend-github/src/implementation';
import type { Config } from 'decap-cms-lib-util/src';
import type { Octokit } from '@octokit/rest';

export default class AwsCognitoGitHubProxyBackend extends GitHubBackend {
constructor(config: Config, options = {}) {
Expand Down Expand Up @@ -44,4 +45,8 @@ export default class AwsCognitoGitHubProxyBackend extends GitHubBackend {
}
return this._currentUserPromise;
}

async getPullRequestAuthor(pullRequest: Octokit.PullsListResponseItem) {
return pullRequest.user?.login;
}
}
2 changes: 1 addition & 1 deletion packages/decap-cms-backend-github/src/API.ts
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ export default class API {
}

try {
const user = await this.user();
const user: GitHubUser = await this.request(`/users/${pullRequest.user.login}`);
return user.name || user.login;
} catch {
return;
Expand Down

0 comments on commit 0e5335d

Please sign in to comment.