@@ -4,7 +4,7 @@ import axios from 'axios';
44const dockerRepoName = 'middlewareeng/middleware' ;
55const githubOrgName = 'middlewarehq' ;
66const githubRepoName = 'middleware' ;
7- const defaultBranch = 'main'
7+ const defaultBranch = 'main' ;
88
99const endpoint = new Endpoint ( nullSchema ) ;
1010
@@ -114,22 +114,19 @@ async function fetchLatestGitHubCommit(): Promise<GitHubCommit> {
114114
115115function isUpdateAvailable ( {
116116 localVersionInfo,
117- dockerLatestRemoteTag,
118- githubLatestCommit
117+ dockerLatestRemoteTag
119118} : {
120119 localVersionInfo : ProjectVersionInfo ;
121120 dockerLatestRemoteTag : TagCompressed ;
122- githubLatestCommit : GitHubCommit ;
123121} ) : boolean {
124122 const env = process . env . NEXT_PUBLIC_APP_ENVIRONMENT ;
125123
126124 if ( env == 'development' ) {
127- const localBuildDate = new Date ( localVersionInfo . current_build_date ) ;
128- const latestRemoteCommitDate = new Date (
129- githubLatestCommit . commit . author . date
130- ) ;
131-
132- return latestRemoteCommitDate > localBuildDate ;
125+ const behindCommitsCount = process . env . BEHIND_COMMITS_COUNT
126+ ? Number ( process . env . BEHIND_COMMITS_COUNT )
127+ : 0 ;
128+ console . log ( 'behindCommitsCount' , behindCommitsCount ) ;
129+ return behindCommitsCount > 0 ;
133130 }
134131
135132 const localBuildDate = new Date ( localVersionInfo . current_build_date ) ;
@@ -163,7 +160,6 @@ async function checkNewImageRelease(): Promise<CheckNewVersionResponse> {
163160 current_github_commit : versionInfo . merge_commit_sha ,
164161 is_update_available : isUpdateAvailable ( {
165162 dockerLatestRemoteTag : latestTag ,
166- githubLatestCommit : githubLatestCommit ,
167163 localVersionInfo : versionInfo
168164 } ) ,
169165 latest_docker_image_build_date : latestRemoteDate
0 commit comments