From a7405f19c3ee85aab3d2051c6d4535fce166d993 Mon Sep 17 00:00:00 2001 From: Peter van der Zee <209817+pvdz@users.noreply.github.com> Date: Mon, 17 Feb 2020 15:50:14 +0100 Subject: [PATCH] feat(gatsby-plugin-benchmark-reporting): Submit commit time of current git hash, too (#21521) --- .../gatsby-plugin-benchmark-reporting/src/gatsby-node.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/gatsby-plugin-benchmark-reporting/src/gatsby-node.js b/packages/gatsby-plugin-benchmark-reporting/src/gatsby-node.js index 30ab3cb2f8c7a..e0a092d8bb981 100644 --- a/packages/gatsby-plugin-benchmark-reporting/src/gatsby-node.js +++ b/packages/gatsby-plugin-benchmark-reporting/src/gatsby-node.js @@ -71,7 +71,11 @@ class BenchMeta { // For the time being, our target benchmarks are part of the main repo // And we will want to know what version of the repo we're testing with + // This won't work as intended when running a site not in our repo (!) const gitHash = execToStr(`git rev-parse HEAD`) + // Git only supports UTC tz through env var, but the unix time stamp is UTC + const unixStamp = execToStr(`git show --quiet --date=unix --format="%cd"`) + const commitTime = new Date(parseInt(unixStamp, 10) * 1000).toISOString() const nodejsVersion = process.version @@ -130,6 +134,7 @@ class BenchMeta { cwd: process.cwd() ?? ``, timestamps: this.timestamps, gitHash, + commitTime, ci: process.env.CI || false, ciName: process.env.CI_NAME || `local`, versions: {