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 committed Aug 5, 2024
1 parent daa62ab commit a46b441
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 a46b441

Please sign in to comment.