fix: removed github url
This commit is contained in:
@@ -194,7 +194,7 @@ export class Tags {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Uses the provided filter (if available) to filter out any tags not currently relevant.
|
* Uses the provided filter (if available) to filter out any tags not currently relevant.
|
||||||
* https://github.com/mikepenz/release-changelog-builder-action/issues/566
|
* https://tagTransformers/mikepenz/release-changelog-builder-action/issues/566
|
||||||
*/
|
*/
|
||||||
export function filterTags(tags: TagInfo[], tagResolver: TagResolver): TagInfo[] {
|
export function filterTags(tags: TagInfo[], tagResolver: TagResolver): TagInfo[] {
|
||||||
const filter = tagResolver.filter
|
const filter = tagResolver.filter
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ export interface ReleaseNotesOptions {
|
|||||||
fetchReviews: boolean // defines if the action should fetch the reviews for the PR.
|
fetchReviews: boolean // defines if the action should fetch the reviews for the PR.
|
||||||
commitMode: boolean // defines if we use the alternative commit based mode. note: this is only partially supported
|
commitMode: boolean // defines if we use the alternative commit based mode. note: this is only partially supported
|
||||||
configuration: Configuration // the configuration as defined in `configuration.ts`
|
configuration: Configuration // the configuration as defined in `configuration.ts`
|
||||||
|
repositoryUtils: BaseRepository
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Data {
|
export interface Data {
|
||||||
@@ -111,7 +112,8 @@ export class ReleaseNotesBuilder {
|
|||||||
fetchReleaseInformation: this.fetchReleaseInformation,
|
fetchReleaseInformation: this.fetchReleaseInformation,
|
||||||
fetchReviews: this.fetchReviews,
|
fetchReviews: this.fetchReviews,
|
||||||
commitMode: this.commitMode,
|
commitMode: this.commitMode,
|
||||||
configuration: this.configuration
|
configuration: this.configuration,
|
||||||
|
repositoryUtils: this.repositoryUtils
|
||||||
}
|
}
|
||||||
const mergedPullRequests = prData.mergedPullRequests
|
const mergedPullRequests = prData.mergedPullRequests
|
||||||
const diffInfo = prData.diffInfo
|
const diffInfo = prData.diffInfo
|
||||||
@@ -164,7 +166,8 @@ export class ReleaseNotesBuilder {
|
|||||||
fetchReleaseInformation: this.fetchReleaseInformation || orgOptions.fetchReleaseInformation,
|
fetchReleaseInformation: this.fetchReleaseInformation || orgOptions.fetchReleaseInformation,
|
||||||
fetchReviews: this.fetchReviews || orgOptions.fetchReviews,
|
fetchReviews: this.fetchReviews || orgOptions.fetchReviews,
|
||||||
commitMode: this.commitMode || orgOptions.commitMode,
|
commitMode: this.commitMode || orgOptions.commitMode,
|
||||||
configuration: this.configuration || orgOptions.configuration
|
configuration: this.configuration || orgOptions.configuration,
|
||||||
|
repositoryUtils: this.repositoryUtils || orgOptions.repositoryUtils
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setOutputs(options, diffInfo, mergedPullRequests)
|
this.setOutputs(options, diffInfo, mergedPullRequests)
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ export abstract class BaseRepository {
|
|||||||
// Define an abstract getter for the default URL
|
// Define an abstract getter for the default URL
|
||||||
abstract get defaultUrl(): string;
|
abstract get defaultUrl(): string;
|
||||||
|
|
||||||
|
abstract get homeUrl():string;
|
||||||
protected constructor(protected token: string, protected url: string | undefined,protected repositoryPath:string) {
|
protected constructor(protected token: string, protected url: string | undefined,protected repositoryPath:string) {
|
||||||
this.proxy = process.env.https_proxy || process.env.HTTPS_PROXY
|
this.proxy = process.env.https_proxy || process.env.HTTPS_PROXY
|
||||||
const noProxy = process.env.no_proxy || process.env.NO_PROXY
|
const noProxy = process.env.no_proxy || process.env.NO_PROXY
|
||||||
|
|||||||
@@ -6,9 +6,11 @@ import {
|
|||||||
} from "../pr-collector/pullRequests";
|
} from "../pr-collector/pullRequests";
|
||||||
import {DiffInfo} from "../pr-collector/commits";
|
import {DiffInfo} from "../pr-collector/commits";
|
||||||
import {Api, PullRequest, PullReview} from "gitea-js";
|
import {Api, PullRequest, PullReview} from "gitea-js";
|
||||||
import moment from "moment";
|
import moment, {min} from "moment";
|
||||||
import * as core from "@actions/core";
|
import * as core from "@actions/core";
|
||||||
import {createCommandManager} from "../pr-collector/gitHelper";
|
import {createCommandManager} from "../pr-collector/gitHelper";
|
||||||
|
import {match} from "assert";
|
||||||
|
import {log} from "util";
|
||||||
|
|
||||||
export class GiteaRepository extends BaseRepository {
|
export class GiteaRepository extends BaseRepository {
|
||||||
private api: Api<unknown>
|
private api: Api<unknown>
|
||||||
@@ -150,27 +152,43 @@ export class GiteaRepository extends BaseRepository {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static pulls:PullRequest[] = [];
|
||||||
|
|
||||||
async getForCommitHash(owner: string, repo: string, commit_sha: string, maxPullRequests: number): Promise<PullRequestInfo[]> {
|
async getForCommitHash(owner: string, repo: string, commit_sha: string, maxPullRequests: number): Promise<PullRequestInfo[]> {
|
||||||
const mergedPRs: PullRequestInfo[] = []
|
const mergedPRs: PullRequestInfo[] = []
|
||||||
|
|
||||||
const response = await this.api.repos.repoListPullRequests(owner, repo, {
|
if(GiteaRepository.pulls.length===0){
|
||||||
sort: 'recentupdate',
|
let page = 1
|
||||||
state: 'closed',
|
let count = 0
|
||||||
limit: 1000,
|
while (count < maxPullRequests){
|
||||||
})
|
let limit = Math.min(50, maxPullRequests)
|
||||||
|
const response = await this.api.repos.repoListPullRequests(owner, repo, {
|
||||||
|
sort: 'recentupdate',
|
||||||
|
state: 'closed',
|
||||||
|
limit: limit,
|
||||||
|
page
|
||||||
|
})
|
||||||
|
if (response.error === null) {
|
||||||
|
GiteaRepository.pulls.push(...response.data)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (response.error === null) {
|
|
||||||
|
|
||||||
for (const pr of response.data) {
|
|
||||||
if (pr.merge_commit_sha === commit_sha) {
|
|
||||||
mergedPRs.push(this.mapPullRequest(pr, pr.merged_at ? 'merged' : 'open'))
|
|
||||||
}
|
}
|
||||||
|
page++;
|
||||||
|
count+= response.data.length
|
||||||
|
if(response.data.length===0)break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const pr of GiteaRepository.pulls) {
|
||||||
|
if (pr.merge_commit_sha === commit_sha) {
|
||||||
|
mergedPRs.push(this.mapPullRequest(pr, pr.merged_at ? 'merged' : 'open'))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
core.debug(`⚠️ No more PRs retrieved from API. Fetched so far: ${mergedPRs.length}`)
|
||||||
|
|
||||||
return mergedPRs
|
return mergedPRs
|
||||||
|
|
||||||
|
|
||||||
@@ -233,4 +251,8 @@ export class GiteaRepository extends BaseRepository {
|
|||||||
return tagsInfo
|
return tagsInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get homeUrl(): string {
|
||||||
|
return "https://gitea.com";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -287,7 +287,7 @@ export class GithubRepository extends BaseRepository {
|
|||||||
for (let i = 0; i < Math.min(pullRequests.length, 3); i++) {
|
for (let i = 0; i < Math.min(pullRequests.length, 3); i++) {
|
||||||
const firstPR = pullRequests[i]
|
const firstPR = pullRequests[i]
|
||||||
if (!firstPR.merged_at) {
|
if (!firstPR.merged_at) {
|
||||||
continue // no merged_at timestamp -> look for the next
|
// no merged_at timestamp -> look for the next
|
||||||
} else if (fromDate.isAfter(moment(firstPR.merged_at))) {
|
} else if (fromDate.isAfter(moment(firstPR.merged_at))) {
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
@@ -296,4 +296,7 @@ export class GithubRepository extends BaseRepository {
|
|||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
get homeUrl(): string {
|
||||||
|
return "https://github.com";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -388,7 +388,7 @@ function fillAdditionalPlaceholders(
|
|||||||
}
|
}
|
||||||
placeholderMap.set(
|
placeholderMap.set(
|
||||||
'RELEASE_DIFF',
|
'RELEASE_DIFF',
|
||||||
`https://github.com/${options.owner}/${options.repo}/compare/${options.fromTag.name}...${options.toTag.name}`
|
`${options.repositoryUtils.homeUrl}/${options.owner}/${options.repo}/compare/${options.fromTag.name}...${options.toTag.name}`
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user