mirror of
https://github.com/gradle/actions.git
synced 2026-08-22 13:52:51 +00:00
Support repo-registration as a second enablement path for project-entry caching
Configuration-cache store/restore is now enabled when EITHER a valid Develocity JWT OR per-repo registration (a GitHub App installation that accepted the T&C) is present. The gate itself lives in the vendored gradle-actions-caching library (refreshed to 0.9.1); this repo wires up the reporting and notice. - ProjectCacheStatus: 'trial-not-licensed' -> 'not-registered'. - caching-report: render the 'not-registered' line with a /register link, and add renderProjectCacheNotice() for a prominent core.notice. - setup-gradle: emit the notice from complete() only when withheld via the registration path; quiet when enabled by either path. - Refresh vendored gradle-actions-caching to 0.9.1. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
b128da9bf0
commit
bc54cf57d1
@@ -1,7 +1,7 @@
|
||||
import {describe, expect, it} from '@jest/globals'
|
||||
|
||||
import {CacheReport} from '../../src/cache-service'
|
||||
import {renderCachingReport} from '../../src/caching-report'
|
||||
import {renderCachingReport, renderProjectCacheNotice} from '../../src/caching-report'
|
||||
|
||||
const ENHANCED = {kind: 'enhanced'} as const
|
||||
const BASIC = {kind: 'basic'} as const
|
||||
@@ -114,6 +114,20 @@ describe('renderCachingReport', () => {
|
||||
expect(md).not.toContain('Project state')
|
||||
})
|
||||
|
||||
it('renders the not-registered status with a /register link inside the details', () => {
|
||||
const report: CacheReport = {
|
||||
status: 'enabled',
|
||||
cleanup: 'enabled',
|
||||
projectCache: 'not-registered',
|
||||
entries: [entry()]
|
||||
}
|
||||
const md = renderCachingReport(report, ENHANCED)
|
||||
|
||||
const detailsBody = md.slice(md.indexOf('</summary>'))
|
||||
expect(detailsBody).toContain('not registered for advanced caching')
|
||||
expect(detailsBody).toContain('/register')
|
||||
})
|
||||
|
||||
it('renders a compact disabled report with no note and no details', () => {
|
||||
const report: CacheReport = {status: 'disabled', entries: []}
|
||||
const md = renderCachingReport(report, undefined)
|
||||
@@ -143,3 +157,20 @@ describe('renderCachingReport', () => {
|
||||
expect(md).not.toContain('<details>')
|
||||
})
|
||||
})
|
||||
|
||||
describe('renderProjectCacheNotice', () => {
|
||||
it('returns a notice with the /register link for the not-registered status', () => {
|
||||
const notice = renderProjectCacheNotice('not-registered')
|
||||
expect(notice).toBeDefined()
|
||||
expect(notice).toContain('not registered')
|
||||
expect(notice).toContain('/register')
|
||||
})
|
||||
|
||||
it('is silent for every other status', () => {
|
||||
expect(renderProjectCacheNotice('enabled')).toBeUndefined()
|
||||
expect(renderProjectCacheNotice('not-enabled')).toBeUndefined()
|
||||
expect(renderProjectCacheNotice('trial-expired')).toBeUndefined()
|
||||
expect(renderProjectCacheNotice('no-encryption-key')).toBeUndefined()
|
||||
expect(renderProjectCacheNotice(undefined)).toBeUndefined()
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user