You've already forked setup-node
							
							
				mirror of
				https://github.com/actions/setup-node.git
				synced 2025-10-30 22:57:58 +07:00 
			
		
		
		
	Add auth
This commit is contained in:
		
							
								
								
									
										12
									
								
								node_modules/octokit-pagination-methods/lib/deprecate.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								node_modules/octokit-pagination-methods/lib/deprecate.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,12 @@ | ||||
| module.exports = deprecate | ||||
|  | ||||
| const loggedMessages = {} | ||||
|  | ||||
| function deprecate (message) { | ||||
|   if (loggedMessages[message]) { | ||||
|     return | ||||
|   } | ||||
|  | ||||
|   console.warn(`DEPRECATED (@octokit/rest): ${message}`) | ||||
|   loggedMessages[message] = 1 | ||||
| } | ||||
							
								
								
									
										7
									
								
								node_modules/octokit-pagination-methods/lib/get-first-page.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								node_modules/octokit-pagination-methods/lib/get-first-page.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,7 @@ | ||||
| module.exports = getFirstPage | ||||
|  | ||||
| const getPage = require('./get-page') | ||||
|  | ||||
| function getFirstPage (octokit, link, headers) { | ||||
|   return getPage(octokit, link, 'first', headers) | ||||
| } | ||||
							
								
								
									
										7
									
								
								node_modules/octokit-pagination-methods/lib/get-last-page.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								node_modules/octokit-pagination-methods/lib/get-last-page.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,7 @@ | ||||
| module.exports = getLastPage | ||||
|  | ||||
| const getPage = require('./get-page') | ||||
|  | ||||
| function getLastPage (octokit, link, headers) { | ||||
|   return getPage(octokit, link, 'last', headers) | ||||
| } | ||||
							
								
								
									
										7
									
								
								node_modules/octokit-pagination-methods/lib/get-next-page.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								node_modules/octokit-pagination-methods/lib/get-next-page.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,7 @@ | ||||
| module.exports = getNextPage | ||||
|  | ||||
| const getPage = require('./get-page') | ||||
|  | ||||
| function getNextPage (octokit, link, headers) { | ||||
|   return getPage(octokit, link, 'next', headers) | ||||
| } | ||||
							
								
								
									
										15
									
								
								node_modules/octokit-pagination-methods/lib/get-page-links.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								node_modules/octokit-pagination-methods/lib/get-page-links.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,15 @@ | ||||
| module.exports = getPageLinks | ||||
|  | ||||
| function getPageLinks (link) { | ||||
|   link = link.link || link.headers.link || '' | ||||
|  | ||||
|   const links = {} | ||||
|  | ||||
|   // link format: | ||||
|   // '<https://api.github.com/users/aseemk/followers?page=2>; rel="next", <https://api.github.com/users/aseemk/followers?page=2>; rel="last"' | ||||
|   link.replace(/<([^>]*)>;\s*rel="([\w]*)"/g, (m, uri, type) => { | ||||
|     links[type] = uri | ||||
|   }) | ||||
|  | ||||
|   return links | ||||
| } | ||||
							
								
								
									
										38
									
								
								node_modules/octokit-pagination-methods/lib/get-page.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								node_modules/octokit-pagination-methods/lib/get-page.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,38 @@ | ||||
| module.exports = getPage | ||||
|  | ||||
| const deprecate = require('./deprecate') | ||||
| const getPageLinks = require('./get-page-links') | ||||
| const HttpError = require('./http-error') | ||||
|  | ||||
| function getPage (octokit, link, which, headers) { | ||||
|   deprecate(`octokit.get${which.charAt(0).toUpperCase() + which.slice(1)}Page() – You can use octokit.paginate or async iterators instead: https://github.com/octokit/rest.js#pagination.`) | ||||
|   const url = getPageLinks(link)[which] | ||||
|  | ||||
|   if (!url) { | ||||
|     const urlError = new HttpError(`No ${which} page found`, 404) | ||||
|     return Promise.reject(urlError) | ||||
|   } | ||||
|  | ||||
|   const requestOptions = { | ||||
|     url, | ||||
|     headers: applyAcceptHeader(link, headers) | ||||
|   } | ||||
|  | ||||
|   const promise = octokit.request(requestOptions) | ||||
|  | ||||
|   return promise | ||||
| } | ||||
|  | ||||
| function applyAcceptHeader (res, headers) { | ||||
|   const previous = res.headers && res.headers['x-github-media-type'] | ||||
|  | ||||
|   if (!previous || (headers && headers.accept)) { | ||||
|     return headers | ||||
|   } | ||||
|   headers = headers || {} | ||||
|   headers.accept = 'application/vnd.' + previous | ||||
|     .replace('; param=', '.') | ||||
|     .replace('; format=', '+') | ||||
|  | ||||
|   return headers | ||||
| } | ||||
							
								
								
									
										7
									
								
								node_modules/octokit-pagination-methods/lib/get-previous-page.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								node_modules/octokit-pagination-methods/lib/get-previous-page.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,7 @@ | ||||
| module.exports = getPreviousPage | ||||
|  | ||||
| const getPage = require('./get-page') | ||||
|  | ||||
| function getPreviousPage (octokit, link, headers) { | ||||
|   return getPage(octokit, link, 'prev', headers) | ||||
| } | ||||
							
								
								
									
										9
									
								
								node_modules/octokit-pagination-methods/lib/has-first-page.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								node_modules/octokit-pagination-methods/lib/has-first-page.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,9 @@ | ||||
| module.exports = hasFirstPage | ||||
|  | ||||
| const deprecate = require('./deprecate') | ||||
| const getPageLinks = require('./get-page-links') | ||||
|  | ||||
| function hasFirstPage (link) { | ||||
|   deprecate(`octokit.hasFirstPage() – You can use octokit.paginate or async iterators instead: https://github.com/octokit/rest.js#pagination.`) | ||||
|   return getPageLinks(link).first | ||||
| } | ||||
							
								
								
									
										9
									
								
								node_modules/octokit-pagination-methods/lib/has-last-page.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								node_modules/octokit-pagination-methods/lib/has-last-page.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,9 @@ | ||||
| module.exports = hasLastPage | ||||
|  | ||||
| const deprecate = require('./deprecate') | ||||
| const getPageLinks = require('./get-page-links') | ||||
|  | ||||
| function hasLastPage (link) { | ||||
|   deprecate(`octokit.hasLastPage() – You can use octokit.paginate or async iterators instead: https://github.com/octokit/rest.js#pagination.`) | ||||
|   return getPageLinks(link).last | ||||
| } | ||||
							
								
								
									
										9
									
								
								node_modules/octokit-pagination-methods/lib/has-next-page.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								node_modules/octokit-pagination-methods/lib/has-next-page.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,9 @@ | ||||
| module.exports = hasNextPage | ||||
|  | ||||
| const deprecate = require('./deprecate') | ||||
| const getPageLinks = require('./get-page-links') | ||||
|  | ||||
| function hasNextPage (link) { | ||||
|   deprecate(`octokit.hasNextPage() – You can use octokit.paginate or async iterators instead: https://github.com/octokit/rest.js#pagination.`) | ||||
|   return getPageLinks(link).next | ||||
| } | ||||
							
								
								
									
										9
									
								
								node_modules/octokit-pagination-methods/lib/has-previous-page.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								node_modules/octokit-pagination-methods/lib/has-previous-page.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,9 @@ | ||||
| module.exports = hasPreviousPage | ||||
|  | ||||
| const deprecate = require('./deprecate') | ||||
| const getPageLinks = require('./get-page-links') | ||||
|  | ||||
| function hasPreviousPage (link) { | ||||
|   deprecate(`octokit.hasPreviousPage() – You can use octokit.paginate or async iterators instead: https://github.com/octokit/rest.js#pagination.`) | ||||
|   return getPageLinks(link).prev | ||||
| } | ||||
							
								
								
									
										15
									
								
								node_modules/octokit-pagination-methods/lib/http-error.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								node_modules/octokit-pagination-methods/lib/http-error.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,15 @@ | ||||
| module.exports = class HttpError extends Error { | ||||
|   constructor (message, code, headers) { | ||||
|     super(message) | ||||
|  | ||||
|     // Maintains proper stack trace (only available on V8) | ||||
|     /* istanbul ignore next */ | ||||
|     if (Error.captureStackTrace) { | ||||
|       Error.captureStackTrace(this, this.constructor) | ||||
|     } | ||||
|  | ||||
|     this.name = 'HttpError' | ||||
|     this.code = code | ||||
|     this.headers = headers | ||||
|   } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Danny McCormick
					Danny McCormick