fix(CodeFeed): Fixed timestamp initialization and commit fetching timeframe
This commit is contained in:
parent
a43114ab61
commit
b59bd82685
@ -1,5 +1,11 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2024-12-16 - 1.6.5 - fix(CodeFeed)
|
||||||
|
Fixed timestamp initialization and commit fetching timeframe
|
||||||
|
|
||||||
|
- Updated the lastRunTimestamp initialization default period from 24 hours to 7 days in CodeFeed constructor.
|
||||||
|
- Modified commit fetching logic to consider commits from the last 7 days instead of 24 hours in fetchRecentCommitsForRepo.
|
||||||
|
|
||||||
## 2024-12-14 - 1.6.4 - fix(core)
|
## 2024-12-14 - 1.6.4 - fix(core)
|
||||||
Refactor fetch logic to use a unified fetchFunction for API calls
|
Refactor fetch logic to use a unified fetchFunction for API calls
|
||||||
|
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@foss.global/codefeed',
|
name: '@foss.global/codefeed',
|
||||||
version: '1.6.4',
|
version: '1.6.5',
|
||||||
description: 'The @foss.global/codefeed module is designed for generating feeds from Gitea repositories, enhancing development workflows by processing commit data and repository activities.'
|
description: 'The @foss.global/codefeed module is designed for generating feeds from Gitea repositories, enhancing development workflows by processing commit data and repository activities.'
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ export class CodeFeed {
|
|||||||
this.baseUrl = baseUrl;
|
this.baseUrl = baseUrl;
|
||||||
this.token = token;
|
this.token = token;
|
||||||
this.lastRunTimestamp =
|
this.lastRunTimestamp =
|
||||||
lastRunTimestamp || new Date(Date.now() - 24 * 60 * 60 * 1000).toISOString();
|
lastRunTimestamp || new Date(Date.now() - 7 * 24 * 60 * 60 * 1000).toISOString();
|
||||||
console.log('CodeFeed initialized with last run timestamp:', this.lastRunTimestamp);
|
console.log('CodeFeed initialized with last run timestamp:', this.lastRunTimestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,7 +198,7 @@ export class CodeFeed {
|
|||||||
owner: string,
|
owner: string,
|
||||||
repo: string
|
repo: string
|
||||||
): Promise<plugins.interfaces.ICommit[]> {
|
): Promise<plugins.interfaces.ICommit[]> {
|
||||||
const twentyFourHoursAgo = new Date(Date.now() - 24 * 60 * 60 * 1000);
|
const commitTimeframe = new Date(Date.now() - (7 * 24 * 60 * 60 * 1000));
|
||||||
let page = 1;
|
let page = 1;
|
||||||
const recentCommits: plugins.interfaces.ICommit[] = [];
|
const recentCommits: plugins.interfaces.ICommit[] = [];
|
||||||
|
|
||||||
@ -223,7 +223,7 @@ export class CodeFeed {
|
|||||||
|
|
||||||
for (const commit of data) {
|
for (const commit of data) {
|
||||||
const commitDate = new Date(commit.commit.author.date);
|
const commitDate = new Date(commit.commit.author.date);
|
||||||
if (commitDate > twentyFourHoursAgo) {
|
if (commitDate > commitTimeframe) {
|
||||||
recentCommits.push(commit);
|
recentCommits.push(commit);
|
||||||
} else {
|
} else {
|
||||||
return recentCommits;
|
return recentCommits;
|
||||||
|
Loading…
Reference in New Issue
Block a user