feat(core): Align GitHub metadata handling with other backends (#3292)
* refactor: code cleanup for GitLab and BitBucket * feat(backend-github): use prs labels for metadata - initial commit * refactor(backend-github): code cleanup, fix tests * fix(backend-github): bug fixes * fix(backend-github): open authoring fixes * fix(backend-github): open authoring fixes * fix(backend-github): fix graphql * test(e2e): update Octokit usage * test(e2e): re-record test data, fix bugs * test(e2e): re-record test data, fix bugs * test(e2e): fix tests * refactor: code cleanup * fix(backend-github): fix migration code * fix(backend-github): don't fail on non existing files collections files * fix(backend-github): use patch attribute instead of slug to get path * fix(backend-github): use compare api to force push a pr * fix(backend-github): fix git-gateway and re-record tests * fix(backend-github): use first commit message as open authoring pr title * refactor(backend-github): code cleanup * test(e2e): fix tests
This commit is contained in:
@ -71,6 +71,20 @@ export default class API extends GithubAPI {
|
||||
return Promise.resolve({ login: '', ...this.commitAuthor });
|
||||
}
|
||||
|
||||
async getHeadReference(head: string) {
|
||||
if (!this.repoOwner) {
|
||||
// get the repo owner from the branch url
|
||||
// this is required for returning the full head reference, e.g. owner:head
|
||||
// when filtering pull requests based on the head
|
||||
const branch = await this.getDefaultBranch();
|
||||
const self = branch._links.self;
|
||||
const regex = new RegExp('https?://.+?/repos/(.+?)/');
|
||||
const owner = self.match(regex);
|
||||
this.repoOwner = owner ? owner[1] : '';
|
||||
}
|
||||
return super.getHeadReference(head);
|
||||
}
|
||||
|
||||
commit(message: string, changeTree: { parentSha?: string; sha: string }) {
|
||||
const commitParams: {
|
||||
message: string;
|
||||
|
Reference in New Issue
Block a user