generateIntegrityAwareCacheKey generates the new-format cache key that includes the integrity level and policy hash as prefixes. Format: memory-{integrityLevel}-{policyHash}-[{cacheID}-]{workflowID}-{runID} The cacheID segment is omitted for the "default" cache ID to maintain a clean key. Examples
(cacheID, integrityLevel, policyHash string)
| 215 | // memory-unapproved-7e4d9f12-${{ env.GH_AW_WORKFLOW_ID_SANITIZED }}-${{ github.run_id }} |
| 216 | // memory-none-nopolicy-session-${{ env.GH_AW_WORKFLOW_ID_SANITIZED }}-${{ github.run_id }} |
| 217 | func generateIntegrityAwareCacheKey(cacheID, integrityLevel, policyHash string) string { |
| 218 | var key string |
| 219 | if cacheID == "default" || cacheID == "" { |
| 220 | key = fmt.Sprintf( |
| 221 | "memory-%s-%s-${{ env.GH_AW_WORKFLOW_ID_SANITIZED }}-${{ github.run_id }}", |
| 222 | integrityLevel, policyHash, |
| 223 | ) |
| 224 | } else { |
| 225 | key = fmt.Sprintf( |
| 226 | "memory-%s-%s-%s-${{ env.GH_AW_WORKFLOW_ID_SANITIZED }}-${{ github.run_id }}", |
| 227 | integrityLevel, policyHash, cacheID, |
| 228 | ) |
| 229 | } |
| 230 | cacheIntegrityLog.Printf("Generated integrity-aware cache key: cacheID=%s, integrityLevel=%s, policyHash=%s", cacheID, integrityLevel, policyHash) |
| 231 | return key |
| 232 | } |