Skip to content

Commit

Permalink
Add Commit Hash of App being deployed
Browse files Browse the repository at this point in the history
  • Loading branch information
itzzritik committed Aug 8, 2021
1 parent f29fb3f commit 69364cd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
6 changes: 5 additions & 1 deletion misc/folderDetails.js

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

2 changes: 1 addition & 1 deletion misc/folderDetails.js.map

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

7 changes: 6 additions & 1 deletion src/misc/folderDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as path from 'path';

import { IAppInfo } from '@rocket.chat/apps-engine/definition/metadata';
import chalk from 'chalk';
import childProcess from 'child_process';
import * as figures from 'figures';
import * as fs from 'fs-extra';
import * as tv4 from 'tv4';
Expand Down Expand Up @@ -50,7 +51,11 @@ export class FolderDetails {
}

try {
this.info = JSON.parse(fs.readFileSync(this.infoFile, { encoding: 'utf-8' }));
const commitHash:string = childProcess.execSync('git rev-parse HEAD', { cwd: this.folder }).toString().trim();
const appInfo = JSON.parse(fs.readFileSync(this.infoFile, { encoding: 'utf-8' }));

appInfo['commitHash'] = commitHash;
this.info = appInfo;
} catch (e) {
throw new Error('The "app.json" file is invalid.');
}
Expand Down

0 comments on commit 69364cd

Please sign in to comment.