From c16920db2bb6eb61b07a88b5604da6f81bd2f570 Mon Sep 17 00:00:00 2001 From: Sebastian Qvarfordt Date: Fri, 2 Oct 2020 11:48:01 +0200 Subject: [PATCH] Always rebuild docs if stored locally (#2719) --- .../techdocs-backend/src/service/helpers.ts | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/plugins/techdocs-backend/src/service/helpers.ts b/plugins/techdocs-backend/src/service/helpers.ts index 6bf3626836..1b8e130ec0 100644 --- a/plugins/techdocs-backend/src/service/helpers.ts +++ b/plugins/techdocs-backend/src/service/helpers.ts @@ -106,16 +106,23 @@ export class DocsBuilder { const buildMetadataStorage = new BuildMetadataStorage( this.entity.metadata.uid, ); - const { target } = getLocationForEntity(this.entity); - const lastCommit = await getLastCommitTimestamp(target, this.logger); - const storageTimeStamp = buildMetadataStorage.getTimestamp(); + const { type, target } = getLocationForEntity(this.entity); - // Check if documentation source is newer than what we have - if (storageTimeStamp && storageTimeStamp >= lastCommit) { - this.logger.debug( - `[TechDocs] Docs for entity ${getEntityId(this.entity)} is up to date.`, - ); - return true; + // Unless docs are stored locally + const nonAgeCheckTypes = ['dir', 'file']; + if (!nonAgeCheckTypes.includes(type)) { + const lastCommit = await getLastCommitTimestamp(target, this.logger); + const storageTimeStamp = buildMetadataStorage.getTimestamp(); + + // Check if documentation source is newer than what we have + if (storageTimeStamp && storageTimeStamp >= lastCommit) { + this.logger.debug( + `[TechDocs] Docs for entity ${getEntityId( + this.entity, + )} is up to date.`, + ); + return true; + } } this.logger.debug(