From 3705f80fceefa04902edae05a7c8c90859c79769 Mon Sep 17 00:00:00 2001
From: Rich Trott <rtrott@gmail.com>
Date: Thu, 13 Jan 2022 07:08:44 -0800
Subject: [PATCH] build: fix workflow access to git history

Refs: https://github.com/nodejs/node/pull/41466

PR-URL: https://github.com/nodejs/node/pull/41472
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Tierney Cyren <hello@bnb.im>
---
 .github/workflows/find-inactive-tsc.yml | 1 +
 tools/find-inactive-tsc.mjs             | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/find-inactive-tsc.yml b/.github/workflows/find-inactive-tsc.yml
index aacb4d1ed56de5d..5d834c8cb25d70c 100644
--- a/.github/workflows/find-inactive-tsc.yml
+++ b/.github/workflows/find-inactive-tsc.yml
@@ -19,6 +19,7 @@ jobs:
       - name: Checkout the repo
         uses: actions/checkout@v2
         with:
+          fetch-depth: 0
           persist-credentials: false
 
       - name: Clone nodejs/TSC repository
diff --git a/tools/find-inactive-tsc.mjs b/tools/find-inactive-tsc.mjs
index acd2cee45b6fb61..362e2ee293922c6 100755
--- a/tools/find-inactive-tsc.mjs
+++ b/tools/find-inactive-tsc.mjs
@@ -211,7 +211,8 @@ async function moveTscToEmeritus(peopleToMove) {
 // only been on the TSC for a week and therefore hasn't attended any meetings.
 const tscMembersAtEnd = await getTscFromReadme();
 
-await runGitCommand(`git checkout 'HEAD@{${SINCE}}' -- README.md`);
+const startCommit = await runGitCommand(`git rev-list -1 --before '${SINCE}' HEAD`);
+await runGitCommand(`git checkout ${startCommit} -- README.md`);
 const tscMembersAtStart = await getTscFromReadme();
 await runGitCommand('git reset HEAD README.md');
 await runGitCommand('git checkout -- README.md');