get-current-sha.js 436 B

12345678910111213141516171819
  1. "use strict";
  2. const log = require("npmlog");
  3. const childProcess = require("@lerna/child-process");
  4. module.exports.getCurrentSHA = getCurrentSHA;
  5. /**
  6. * Retrieve current SHA from git.
  7. * @param {import("@lerna/child-process").ExecOpts} opts
  8. */
  9. function getCurrentSHA(opts) {
  10. log.silly("getCurrentSHA");
  11. const sha = childProcess.execSync("git", ["rev-parse", "HEAD"], opts);
  12. log.verbose("getCurrentSHA", sha);
  13. return sha;
  14. }