Skip to content

Commit 8893f0d

Browse files
authored
build: reduce git noise #3812
Problem: The generateServiceClient task is noisy in CI logs: > ts-node ./scripts/build/generateServiceClient.ts ... Updating files: 66% (2895/4337) Updating files: 67% (2906/4337) Updating files: 68% (2950/4337) Updating files: 69% (2993/4337) Updating files: 70% (3036/4337) ... You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by switching back to a branch. ... Solution: - Use the `--quiet` option. - Pass `advice.detachedHead=false` config option when doing `git checkout`.
1 parent aef5606 commit 8893f0d

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

scripts/build/generateServiceClient.ts

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,20 @@ async function cloneJsSdk(dir: string): Promise<void> {
5656
? // Local repo exists already: just update it and checkout the tag.
5757
// Fetch only the tag we need.
5858
// git fetch origin tag v2.950.0 --no-tags
59-
['-C', dir, 'fetch', 'origin', 'tag', tag, '--no-tags']
59+
['-C', dir, 'fetch', '--quiet', 'origin', 'tag', tag, '--no-tags']
6060
: // Local repo does not exist: clone it.
61-
['clone', '-b', tag, '--depth', '1', 'https://github.com/aws/aws-sdk-js.git', dir]
61+
[
62+
'-c',
63+
'advice.detachedHead=false',
64+
'clone',
65+
'--quiet',
66+
'-b',
67+
tag,
68+
'--depth',
69+
'1',
70+
'https://github.com/aws/aws-sdk-js.git',
71+
dir,
72+
]
6273

6374
const gitCmd = child_process.execFile('git', gitArgs, { encoding: 'utf8' })
6475

@@ -69,7 +80,15 @@ async function cloneJsSdk(dir: string): Promise<void> {
6980
gitCmd.stdout?.removeAllListeners()
7081

7182
// Only needed for the "update" case, but harmless for "clone".
72-
const gitCheckout = child_process.spawnSync('git', ['-C', dir, 'checkout', '--force', tag])
83+
const gitCheckout = child_process.spawnSync('git', [
84+
'-c',
85+
'advice.detachedHead=false',
86+
'-C',
87+
dir,
88+
'checkout',
89+
'--force',
90+
tag,
91+
])
7392
if (gitCheckout.status !== undefined && gitCheckout.status !== 0) {
7493
console.log(`error: git: status=${gitCheckout.status} output=${gitCheckout.output.toString()}`)
7594
}

0 commit comments

Comments
 (0)