Skip to content

Commit

Permalink
- improve formatting
Browse files Browse the repository at this point in the history
- add some more comments
  • Loading branch information
mikepenz authored Nov 5, 2023
1 parent 2538eab commit 0e00e18
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 10 deletions.
2 changes: 1 addition & 1 deletion __tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jest.setTimeout(180000)

test('missing values should result in failure', () => {
expect.assertions(1)

process.env['GITHUB_WORKSPACE'] = '.'
process.env['INPUT_OWNER'] = undefined
process.env['INPUT_CONFIGURATION'] = 'configs/configuration.json'
Expand Down
19 changes: 12 additions & 7 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/repositories/BaseRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ export abstract class BaseRepository {
// Define an abstract getter for the default URL
abstract get defaultUrl(): string

// Define the abstract getter for the home URL (also used for some replace patterns)
abstract get homeUrl(): string

protected constructor(
protected token: string,
protected url: string | undefined,
Expand Down
7 changes: 6 additions & 1 deletion src/repositories/GiteaRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {Api, PullRequest, PullReview, giteaApi} from 'gitea-js'
import moment from 'moment'
import * as core from '@actions/core'
import {createCommandManager} from '../pr-collector/gitHelper'

interface Pulls {
closed: PullRequest[]
open: PullRequest[]
Expand Down Expand Up @@ -85,6 +86,10 @@ export class GiteaRepository extends BaseRepository {
}
}

/**
* WARNING: This does not actually get the diff from the remote, as Gitea does not offer a compareable API.
* This uses the local repository to get the diff. NOTE: As such, gitea integration requires the repo available.
*/
async getDiffRemote(owner: string, repo: string, base: string, head: string): Promise<DiffInfo> {
let changedFilesCount = 0
let additionCount = 0
Expand Down Expand Up @@ -223,7 +228,7 @@ export class GiteaRepository extends BaseRepository {
})

async getTags(owner: string, repo: string, maxTagsToFetch: number): Promise<TagInfo[]> {
core.debug(`start to get gitea tag `)
core.debug(`Start to get tag from gitea`)
const response = await this.api.repos.repoListTags(owner, repo, {
limit: maxTagsToFetch
})
Expand Down
1 change: 1 addition & 0 deletions src/repositories/GithubRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ export class GithubRepository extends BaseRepository {
body: comment.body,
state: comment.state
})

private fetchedEnough(pullRequests: PullsListData, fromDate: moment.Moment): boolean {
for (let i = 0; i < Math.min(pullRequests.length, 3); i++) {
const firstPR = pullRequests[i]
Expand Down

0 comments on commit 0e00e18

Please sign in to comment.