Fix v1 cache service to only check ACTIONS_CACHE_URL
Co-authored-by: Link- <568794+Link-@users.noreply.github.com>
This commit is contained in:
1 parent
c0e1707545
commit
780c52920e
2 files changed
+6
-8
No files matched your search
@@ -22,9 +22,9 @@ describe('isFeatureAvailable', () => {
|
|||||||
expect(cache.isFeatureAvailable()).toBe(true)
|
expect(cache.isFeatureAvailable()).toBe(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
test('returns true for cache service v1 when ACTIONS_RESULTS_URL is set', () => {
|
test('returns false for cache service v1 when only ACTIONS_RESULTS_URL is set', () => {
|
||||||
process.env['ACTIONS_RESULTS_URL'] = 'http://results.com'
|
process.env['ACTIONS_RESULTS_URL'] = 'http://results.com'
|
||||||
expect(cache.isFeatureAvailable()).toBe(true)
|
expect(cache.isFeatureAvailable()).toBe(false)
|
||||||
})
|
})
|
||||||
|
|
||||||
test('returns true for cache service v1 when both URLs are set', () => {
|
test('returns true for cache service v1 when both URLs are set', () => {
|
||||||
@@ -61,9 +61,9 @@ describe('isFeatureAvailable', () => {
|
|||||||
expect(cache.isFeatureAvailable()).toBe(true)
|
expect(cache.isFeatureAvailable()).toBe(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
test('returns true for GHES with ACTIONS_RESULTS_URL', () => {
|
test('returns false for GHES with only ACTIONS_RESULTS_URL', () => {
|
||||||
process.env['GITHUB_SERVER_URL'] = 'https://my-enterprise.github.com'
|
process.env['GITHUB_SERVER_URL'] = 'https://my-enterprise.github.com'
|
||||||
process.env['ACTIONS_RESULTS_URL'] = 'http://results.com'
|
process.env['ACTIONS_RESULTS_URL'] = 'http://results.com'
|
||||||
expect(cache.isFeatureAvailable()).toBe(true)
|
expect(cache.isFeatureAvailable()).toBe(false)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
+2
-4
@@ -67,10 +67,8 @@ export function isFeatureAvailable(): boolean {
|
|||||||
return !!process.env['ACTIONS_RESULTS_URL']
|
return !!process.env['ACTIONS_RESULTS_URL']
|
||||||
case 'v1':
|
case 'v1':
|
||||||
default:
|
default:
|
||||||
// For v1, we need either ACTIONS_CACHE_URL or ACTIONS_RESULTS_URL
|
// For v1, we only need ACTIONS_CACHE_URL
|
||||||
return !!(
|
return !!process.env['ACTIONS_CACHE_URL']
|
||||||
process.env['ACTIONS_CACHE_URL'] || process.env['ACTIONS_RESULTS_URL']
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user