Skip to content

Commit

Permalink
Merge pull request RocketChat#10 from WideChat/feature/display_commit…
Browse files Browse the repository at this point in the history
…_hash_for_rc_apps

Display commit hash for RC Apps
  • Loading branch information
ear-dev authored Aug 16, 2021
2 parents f29fb3f + 69364cd commit 23b9cf8
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 23b9cf8

Please sign in to comment.