You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Only run this script if the given package has been published
17
19
// Check if the current git HEAD has a tag containing the package name
18
-
try{
19
-
consttags=execSync('git tag --contains HEAD',{
20
-
cwd: gitRoot,
21
-
}).toString()
20
+
// This is a bit odd versus just having the cache purge on a prepublish hooks, but publish hooks like post/prepublish had been flaky on CI with changesets when I was setting this up.
21
+
if(process.env.CI){
22
+
console.log('Searching for matching tag for package...')
23
+
try{
24
+
consttags=execSync('git tag --contains HEAD',{
25
+
cwd: gitRoot,
26
+
}).toString()
22
27
23
-
consthasMatchingTag=tags.includes(packageName)
24
-
if(!hasMatchingTag){
25
-
console.log(
26
-
`No tags containing the package name "${packageName}" found on the current git HEAD. Aborting cache purge.`
27
-
)
28
-
process.exit(0)
28
+
consthasMatchingTag=tags.includes(packageName)
29
+
if(!hasMatchingTag){
30
+
console.log(
31
+
`No tags containing the package name "${packageName}" found on the current git HEAD. Aborting cache purge.`
32
+
)
33
+
process.exit(0)
34
+
}
35
+
}catch(error){
36
+
console.error(`Failed to check git tags: ${error.message}`)
37
+
process.exit(1)
29
38
}
30
-
}catch(error){
31
-
console.error(`Failed to check git tags: ${error.message}`)
0 commit comments