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.
|
||||
* 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[] {
|
||||
const filter = tagResolver.filter
|
||||
|
||||
@@ -22,6 +22,7 @@ export interface ReleaseNotesOptions {
|
||||
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
|
||||
configuration: Configuration // the configuration as defined in `configuration.ts`
|
||||
repositoryUtils: BaseRepository
|
||||
}
|
||||
|
||||
export interface Data {
|
||||
@@ -111,7 +112,8 @@ export class ReleaseNotesBuilder {
|
||||
fetchReleaseInformation: this.fetchReleaseInformation,
|
||||
fetchReviews: this.fetchReviews,
|
||||
commitMode: this.commitMode,
|
||||
configuration: this.configuration
|
||||
configuration: this.configuration,
|
||||
repositoryUtils: this.repositoryUtils
|
||||
}
|
||||
const mergedPullRequests = prData.mergedPullRequests
|
||||
const diffInfo = prData.diffInfo
|
||||
@@ -164,7 +166,8 @@ export class ReleaseNotesBuilder {
|
||||
fetchReleaseInformation: this.fetchReleaseInformation || orgOptions.fetchReleaseInformation,
|
||||
fetchReviews: this.fetchReviews || orgOptions.fetchReviews,
|
||||
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)
|
||||
|
||||
@@ -13,6 +13,7 @@ export abstract class BaseRepository {
|
||||
// Define an abstract getter for the default URL
|
||||
abstract get defaultUrl(): string;
|
||||
|
||||
abstract get homeUrl():string;
|
||||
protected constructor(protected token: string, protected url: string | undefined,protected repositoryPath:string) {
|
||||
this.proxy = process.env.https_proxy || process.env.HTTPS_PROXY
|
||||
const noProxy = process.env.no_proxy || process.env.NO_PROXY
|
||||
|
||||
@@ -6,9 +6,11 @@ import {
|
||||
} from "../pr-collector/pullRequests";
|
||||
import {DiffInfo} from "../pr-collector/commits";
|
||||
import {Api, PullRequest, PullReview} from "gitea-js";
|
||||
import moment from "moment";
|
||||
import moment, {min} from "moment";
|
||||
import * as core from "@actions/core";
|
||||
import {createCommandManager} from "../pr-collector/gitHelper";
|
||||
import {match} from "assert";
|
||||
import {log} from "util";
|
||||
|
||||
export class GiteaRepository extends BaseRepository {
|
||||
private api: Api<unknown>
|
||||
@@ -150,26 +152,42 @@ export class GiteaRepository extends BaseRepository {
|
||||
};
|
||||
}
|
||||
|
||||
static pulls:PullRequest[] = [];
|
||||
|
||||
async getForCommitHash(owner: string, repo: string, commit_sha: string, maxPullRequests: number): Promise<PullRequestInfo[]> {
|
||||
const mergedPRs: PullRequestInfo[] = []
|
||||
|
||||
if(GiteaRepository.pulls.length===0){
|
||||
let page = 1
|
||||
let count = 0
|
||||
while (count < maxPullRequests){
|
||||
let limit = Math.min(50, maxPullRequests)
|
||||
const response = await this.api.repos.repoListPullRequests(owner, repo, {
|
||||
sort: 'recentupdate',
|
||||
state: 'closed',
|
||||
limit: 1000,
|
||||
limit: limit,
|
||||
page
|
||||
})
|
||||
|
||||
|
||||
|
||||
if (response.error === null) {
|
||||
GiteaRepository.pulls.push(...response.data)
|
||||
|
||||
for (const pr of response.data) {
|
||||
}
|
||||
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
|
||||
|
||||
@@ -233,4 +251,8 @@ export class GiteaRepository extends BaseRepository {
|
||||
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++) {
|
||||
const firstPR = pullRequests[i]
|
||||
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))) {
|
||||
return true
|
||||
} else {
|
||||
@@ -296,4 +296,7 @@ export class GithubRepository extends BaseRepository {
|
||||
}
|
||||
return false
|
||||
}
|
||||
get homeUrl(): string {
|
||||
return "https://github.com";
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -388,7 +388,7 @@ function fillAdditionalPlaceholders(
|
||||
}
|
||||
placeholderMap.set(
|
||||
'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