mirror of
				https://github.com/actions/cache.git
				synced 2025-11-04 07:38:37 +08:00 
			
		
		
		
	Consume @actions/http-client:1.0.5
This commit is contained in:
		
							parent
							
								
									f37c19eacb
								
							
						
					
					
						commit
						a0d78414ab
					
				
							
								
								
									
										6
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										6
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							| 
						 | 
					@ -15,9 +15,9 @@
 | 
				
			||||||
      "integrity": "sha512-nvFkxwiicvpzNiCBF4wFBDfnBvi7xp/as7LE1hBxBxKG2L29+gkIPBiLKMVORL+Hg3JNf07AKRfl0V5djoypjQ=="
 | 
					      "integrity": "sha512-nvFkxwiicvpzNiCBF4wFBDfnBvi7xp/as7LE1hBxBxKG2L29+gkIPBiLKMVORL+Hg3JNf07AKRfl0V5djoypjQ=="
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "@actions/http-client": {
 | 
					    "@actions/http-client": {
 | 
				
			||||||
      "version": "1.0.4",
 | 
					      "version": "1.0.5",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.4.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.5.tgz",
 | 
				
			||||||
      "integrity": "sha512-6EzXhqapKKtYr21ZnFQVBYwfrYPKPCivuSkUN/66/BDakkH2EPjUZH8tZ3MgHdI+gQIdcsY0ybbxw9ZEOmJB6g==",
 | 
					      "integrity": "sha512-kX9T1EwfohZU/iTHei0nQlykxdTV9xvKMeHYTtYkfkgBKoe2Z0z0IP3ANVYTsFAlycMwLheBhVEBTm2XvGhR1Q==",
 | 
				
			||||||
      "requires": {
 | 
					      "requires": {
 | 
				
			||||||
        "tunnel": "0.0.6"
 | 
					        "tunnel": "0.0.6"
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -26,7 +26,7 @@
 | 
				
			||||||
  "dependencies": {
 | 
					  "dependencies": {
 | 
				
			||||||
    "@actions/core": "^1.2.0",
 | 
					    "@actions/core": "^1.2.0",
 | 
				
			||||||
    "@actions/exec": "^1.0.1",
 | 
					    "@actions/exec": "^1.0.1",
 | 
				
			||||||
    "@actions/http-client": "^1.0.4",
 | 
					    "@actions/http-client": "^1.0.5",
 | 
				
			||||||
    "@actions/io": "^1.0.1",
 | 
					    "@actions/io": "^1.0.1",
 | 
				
			||||||
    "uuid": "^3.3.3"
 | 
					    "uuid": "^3.3.3"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,16 +1,17 @@
 | 
				
			||||||
import * as core from "@actions/core";
 | 
					import * as core from "@actions/core";
 | 
				
			||||||
import * as fs from "fs";
 | 
					import * as fs from "fs";
 | 
				
			||||||
import { BearerCredentialHandler } from "@actions/http-client/auth";
 | 
					import { BearerCredentialHandler } from "@actions/http-client/auth";
 | 
				
			||||||
import { HttpClient, HttpCodes, ITypedResponse } from "@actions/http-client";
 | 
					import { HttpClient, HttpCodes } from "@actions/http-client";
 | 
				
			||||||
import {
 | 
					import {
 | 
				
			||||||
    IHttpClientResponse,
 | 
					    IHttpClientResponse,
 | 
				
			||||||
    IRequestOptions,
 | 
					    IRequestOptions,
 | 
				
			||||||
    IHeaders
 | 
					    ITypedResponse
 | 
				
			||||||
} from "@actions/http-client/interfaces";
 | 
					} from "@actions/http-client/interfaces";
 | 
				
			||||||
import {
 | 
					import {
 | 
				
			||||||
    ArtifactCacheEntry,
 | 
					    ArtifactCacheEntry,
 | 
				
			||||||
    CommitCacheRequest,
 | 
					    CommitCacheRequest,
 | 
				
			||||||
    ReserveCacheRequest
 | 
					    ReserveCacheRequest,
 | 
				
			||||||
 | 
					    ReserveCacheResponse
 | 
				
			||||||
} from "./contracts";
 | 
					} from "./contracts";
 | 
				
			||||||
import * as utils from "./utils/actionUtils";
 | 
					import * as utils from "./utils/actionUtils";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -135,7 +136,7 @@ export async function reserveCache(key: string): Promise<number> {
 | 
				
			||||||
    const additionalHeaders = {
 | 
					    const additionalHeaders = {
 | 
				
			||||||
        "Content-Type": "application/json"
 | 
					        "Content-Type": "application/json"
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
    const response = await httpClient.postJson<any>(
 | 
					    const response = await httpClient.postJson<ReserveCacheResponse>(
 | 
				
			||||||
        getCacheApiUrl("caches"),
 | 
					        getCacheApiUrl("caches"),
 | 
				
			||||||
        reserveCacheRequest,
 | 
					        reserveCacheRequest,
 | 
				
			||||||
        additionalHeaders
 | 
					        additionalHeaders
 | 
				
			||||||
| 
						 | 
					@ -266,12 +267,12 @@ async function commitCache(
 | 
				
			||||||
    httpClient: HttpClient,
 | 
					    httpClient: HttpClient,
 | 
				
			||||||
    cacheId: number,
 | 
					    cacheId: number,
 | 
				
			||||||
    filesize: number
 | 
					    filesize: number
 | 
				
			||||||
): Promise<ITypedResponse<any>> {
 | 
					): Promise<ITypedResponse<null>> {
 | 
				
			||||||
    const commitCacheRequest: CommitCacheRequest = { size: filesize };
 | 
					    const commitCacheRequest: CommitCacheRequest = { size: filesize };
 | 
				
			||||||
    const additionalHeaders = {
 | 
					    const additionalHeaders = {
 | 
				
			||||||
        "Content-Type": "application/json"
 | 
					        "Content-Type": "application/json"
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
    return await httpClient.postJson<any>(
 | 
					    return await httpClient.postJson<null>(
 | 
				
			||||||
        getCacheApiUrl(`caches/${cacheId.toString()}`),
 | 
					        getCacheApiUrl(`caches/${cacheId.toString()}`),
 | 
				
			||||||
        commitCacheRequest,
 | 
					        commitCacheRequest,
 | 
				
			||||||
        additionalHeaders
 | 
					        additionalHeaders
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user