refactor: remove redundant API call (#175)
Combines the two installation requests (org and user) into one because
`/org/{org}` can also be accessed at `/users/{org}`.
---------
Co-authored-by: Gregor Martynus <[email protected]>
This commit is contained in:
co-authored by
Gregor Martynus
parent
a2c2dfabb4
commit
25cc3bdc27
Vendored
+180
-67
@@ -561,10 +561,10 @@ var require_proxy = __commonJS({
|
|||||||
})();
|
})();
|
||||||
if (proxyVar) {
|
if (proxyVar) {
|
||||||
try {
|
try {
|
||||||
return new URL(proxyVar);
|
return new DecodedURL(proxyVar);
|
||||||
} catch (_a) {
|
} catch (_a) {
|
||||||
if (!proxyVar.startsWith("http://") && !proxyVar.startsWith("https://"))
|
if (!proxyVar.startsWith("http://") && !proxyVar.startsWith("https://"))
|
||||||
return new URL(`http://${proxyVar}`);
|
return new DecodedURL(`http://${proxyVar}`);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return void 0;
|
return void 0;
|
||||||
@@ -607,6 +607,19 @@ var require_proxy = __commonJS({
|
|||||||
const hostLower = host.toLowerCase();
|
const hostLower = host.toLowerCase();
|
||||||
return hostLower === "localhost" || hostLower.startsWith("127.") || hostLower.startsWith("[::1]") || hostLower.startsWith("[0:0:0:0:0:0:0:1]");
|
return hostLower === "localhost" || hostLower.startsWith("127.") || hostLower.startsWith("[::1]") || hostLower.startsWith("[0:0:0:0:0:0:0:1]");
|
||||||
}
|
}
|
||||||
|
var DecodedURL = class extends URL {
|
||||||
|
constructor(url, base) {
|
||||||
|
super(url, base);
|
||||||
|
this._decodedUsername = decodeURIComponent(super.username);
|
||||||
|
this._decodedPassword = decodeURIComponent(super.password);
|
||||||
|
}
|
||||||
|
get username() {
|
||||||
|
return this._decodedUsername;
|
||||||
|
}
|
||||||
|
get password() {
|
||||||
|
return this._decodedPassword;
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -18141,7 +18154,7 @@ var require_lib = __commonJS({
|
|||||||
}
|
}
|
||||||
const usingSsl = parsedUrl.protocol === "https:";
|
const usingSsl = parsedUrl.protocol === "https:";
|
||||||
proxyAgent = new undici_1.ProxyAgent(Object.assign({ uri: proxyUrl2.href, pipelining: !this._keepAlive ? 0 : 1 }, (proxyUrl2.username || proxyUrl2.password) && {
|
proxyAgent = new undici_1.ProxyAgent(Object.assign({ uri: proxyUrl2.href, pipelining: !this._keepAlive ? 0 : 1 }, (proxyUrl2.username || proxyUrl2.password) && {
|
||||||
token: `${proxyUrl2.username}:${proxyUrl2.password}`
|
token: `Basic ${Buffer.from(`${proxyUrl2.username}:${proxyUrl2.password}`).toString("base64")}`
|
||||||
}));
|
}));
|
||||||
this._proxyAgentDispatcher = proxyAgent;
|
this._proxyAgentDispatcher = proxyAgent;
|
||||||
if (usingSsl && this._ignoreSslError) {
|
if (usingSsl && this._ignoreSslError) {
|
||||||
@@ -36979,11 +36992,11 @@ var RequestError = class extends Error {
|
|||||||
response;
|
response;
|
||||||
constructor(message, statusCode, options) {
|
constructor(message, statusCode, options) {
|
||||||
super(message);
|
super(message);
|
||||||
if (Error.captureStackTrace) {
|
|
||||||
Error.captureStackTrace(this, this.constructor);
|
|
||||||
}
|
|
||||||
this.name = "HttpError";
|
this.name = "HttpError";
|
||||||
this.status = statusCode;
|
this.status = Number.parseInt(statusCode);
|
||||||
|
if (Number.isNaN(this.status)) {
|
||||||
|
this.status = 0;
|
||||||
|
}
|
||||||
if ("response" in options) {
|
if ("response" in options) {
|
||||||
this.response = options.response;
|
this.response = options.response;
|
||||||
}
|
}
|
||||||
@@ -37984,14 +37997,13 @@ var Stack = class _Stack {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
var LRUCache = class _LRUCache {
|
var LRUCache = class _LRUCache {
|
||||||
// properties coming in from the options of these, only max and maxSize
|
// options that cannot be changed without disaster
|
||||||
// really *need* to be protected. The rest can be modified, as they just
|
|
||||||
// set defaults for various methods.
|
|
||||||
#max;
|
#max;
|
||||||
#maxSize;
|
#maxSize;
|
||||||
#dispose;
|
#dispose;
|
||||||
#disposeAfter;
|
#disposeAfter;
|
||||||
#fetchMethod;
|
#fetchMethod;
|
||||||
|
#memoMethod;
|
||||||
/**
|
/**
|
||||||
* {@link LRUCache.OptionsBase.ttl}
|
* {@link LRUCache.OptionsBase.ttl}
|
||||||
*/
|
*/
|
||||||
@@ -38137,6 +38149,9 @@ var LRUCache = class _LRUCache {
|
|||||||
get fetchMethod() {
|
get fetchMethod() {
|
||||||
return this.#fetchMethod;
|
return this.#fetchMethod;
|
||||||
}
|
}
|
||||||
|
get memoMethod() {
|
||||||
|
return this.#memoMethod;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* {@link LRUCache.OptionsBase.dispose} (read-only)
|
* {@link LRUCache.OptionsBase.dispose} (read-only)
|
||||||
*/
|
*/
|
||||||
@@ -38150,7 +38165,7 @@ var LRUCache = class _LRUCache {
|
|||||||
return this.#disposeAfter;
|
return this.#disposeAfter;
|
||||||
}
|
}
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
const { max = 0, ttl, ttlResolution = 1, ttlAutopurge, updateAgeOnGet, updateAgeOnHas, allowStale, dispose, disposeAfter, noDisposeOnSet, noUpdateTTL, maxSize = 0, maxEntrySize = 0, sizeCalculation, fetchMethod, noDeleteOnFetchRejection, noDeleteOnStaleGet, allowStaleOnFetchRejection, allowStaleOnFetchAbort, ignoreFetchAbort } = options;
|
const { max = 0, ttl, ttlResolution = 1, ttlAutopurge, updateAgeOnGet, updateAgeOnHas, allowStale, dispose, disposeAfter, noDisposeOnSet, noUpdateTTL, maxSize = 0, maxEntrySize = 0, sizeCalculation, fetchMethod, memoMethod, noDeleteOnFetchRejection, noDeleteOnStaleGet, allowStaleOnFetchRejection, allowStaleOnFetchAbort, ignoreFetchAbort } = options;
|
||||||
if (max !== 0 && !isPosInt(max)) {
|
if (max !== 0 && !isPosInt(max)) {
|
||||||
throw new TypeError("max option must be a nonnegative integer");
|
throw new TypeError("max option must be a nonnegative integer");
|
||||||
}
|
}
|
||||||
@@ -38170,6 +38185,10 @@ var LRUCache = class _LRUCache {
|
|||||||
throw new TypeError("sizeCalculation set to non-function");
|
throw new TypeError("sizeCalculation set to non-function");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (memoMethod !== void 0 && typeof memoMethod !== "function") {
|
||||||
|
throw new TypeError("memoMethod must be a function if defined");
|
||||||
|
}
|
||||||
|
this.#memoMethod = memoMethod;
|
||||||
if (fetchMethod !== void 0 && typeof fetchMethod !== "function") {
|
if (fetchMethod !== void 0 && typeof fetchMethod !== "function") {
|
||||||
throw new TypeError("fetchMethod must be a function if specified");
|
throw new TypeError("fetchMethod must be a function if specified");
|
||||||
}
|
}
|
||||||
@@ -38240,7 +38259,8 @@ var LRUCache = class _LRUCache {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Return the remaining TTL time for a given entry key
|
* Return the number of ms left in the item's TTL. If item is not in cache,
|
||||||
|
* returns `0`. Returns `Infinity` if item is in cache without a defined TTL.
|
||||||
*/
|
*/
|
||||||
getRemainingTTL(key) {
|
getRemainingTTL(key) {
|
||||||
return this.#keyMap.has(key) ? Infinity : 0;
|
return this.#keyMap.has(key) ? Infinity : 0;
|
||||||
@@ -38256,7 +38276,7 @@ var LRUCache = class _LRUCache {
|
|||||||
if (ttl !== 0 && this.ttlAutopurge) {
|
if (ttl !== 0 && this.ttlAutopurge) {
|
||||||
const t = setTimeout(() => {
|
const t = setTimeout(() => {
|
||||||
if (this.#isStale(index)) {
|
if (this.#isStale(index)) {
|
||||||
this.delete(this.#keyList[index]);
|
this.#delete(this.#keyList[index], "expire");
|
||||||
}
|
}
|
||||||
}, ttl + 1);
|
}, ttl + 1);
|
||||||
if (t.unref) {
|
if (t.unref) {
|
||||||
@@ -38493,13 +38513,14 @@ var LRUCache = class _LRUCache {
|
|||||||
return this.entries();
|
return this.entries();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* A String value that is used in the creation of the default string description of an object.
|
* A String value that is used in the creation of the default string
|
||||||
* Called by the built-in method Object.prototype.toString.
|
* description of an object. Called by the built-in method
|
||||||
|
* `Object.prototype.toString`.
|
||||||
*/
|
*/
|
||||||
[Symbol.toStringTag] = "LRUCache";
|
[Symbol.toStringTag] = "LRUCache";
|
||||||
/**
|
/**
|
||||||
* Find a value for which the supplied fn method returns a truthy value,
|
* Find a value for which the supplied fn method returns a truthy value,
|
||||||
* similar to Array.find(). fn is called as fn(value, key, cache).
|
* similar to `Array.find()`. fn is called as `fn(value, key, cache)`.
|
||||||
*/
|
*/
|
||||||
find(fn, getOptions = {}) {
|
find(fn, getOptions = {}) {
|
||||||
for (const i of this.#indexes()) {
|
for (const i of this.#indexes()) {
|
||||||
@@ -38513,10 +38534,15 @@ var LRUCache = class _LRUCache {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Call the supplied function on each item in the cache, in order from
|
* Call the supplied function on each item in the cache, in order from most
|
||||||
* most recently used to least recently used. fn is called as
|
* recently used to least recently used.
|
||||||
* fn(value, key, cache). Does not update age or recenty of use.
|
*
|
||||||
* Does not iterate over stale values.
|
* `fn` is called as `fn(value, key, cache)`.
|
||||||
|
*
|
||||||
|
* If `thisp` is provided, function will be called in the `this`-context of
|
||||||
|
* the provided object, or the cache if no `thisp` object is provided.
|
||||||
|
*
|
||||||
|
* Does not update age or recenty of use, or iterate over stale values.
|
||||||
*/
|
*/
|
||||||
forEach(fn, thisp = this) {
|
forEach(fn, thisp = this) {
|
||||||
for (const i of this.#indexes()) {
|
for (const i of this.#indexes()) {
|
||||||
@@ -38548,7 +38574,7 @@ var LRUCache = class _LRUCache {
|
|||||||
let deleted = false;
|
let deleted = false;
|
||||||
for (const i of this.#rindexes({ allowStale: true })) {
|
for (const i of this.#rindexes({ allowStale: true })) {
|
||||||
if (this.#isStale(i)) {
|
if (this.#isStale(i)) {
|
||||||
this.delete(this.#keyList[i]);
|
this.#delete(this.#keyList[i], "expire");
|
||||||
deleted = true;
|
deleted = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -38556,9 +38582,15 @@ var LRUCache = class _LRUCache {
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Get the extended info about a given entry, to get its value, size, and
|
* Get the extended info about a given entry, to get its value, size, and
|
||||||
* TTL info simultaneously. Like {@link LRUCache#dump}, but just for a
|
* TTL info simultaneously. Returns `undefined` if the key is not present.
|
||||||
* single key. Always returns stale values, if their info is found in the
|
*
|
||||||
* cache, so be sure to check for expired TTLs if relevant.
|
* Unlike {@link LRUCache#dump}, which is designed to be portable and survive
|
||||||
|
* serialization, the `start` value is always the current timestamp, and the
|
||||||
|
* `ttl` is a calculated remaining time to live (negative if expired).
|
||||||
|
*
|
||||||
|
* Always returns stale values, if their info is found in the cache, so be
|
||||||
|
* sure to check for expirations (ie, a negative {@link LRUCache.Entry#ttl})
|
||||||
|
* if relevant.
|
||||||
*/
|
*/
|
||||||
info(key) {
|
info(key) {
|
||||||
const i = this.#keyMap.get(key);
|
const i = this.#keyMap.get(key);
|
||||||
@@ -38585,7 +38617,16 @@ var LRUCache = class _LRUCache {
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Return an array of [key, {@link LRUCache.Entry}] tuples which can be
|
* Return an array of [key, {@link LRUCache.Entry}] tuples which can be
|
||||||
* passed to cache.load()
|
* passed to {@link LRLUCache#load}.
|
||||||
|
*
|
||||||
|
* The `start` fields are calculated relative to a portable `Date.now()`
|
||||||
|
* timestamp, even if `performance.now()` is available.
|
||||||
|
*
|
||||||
|
* Stale entries are always included in the `dump`, even if
|
||||||
|
* {@link LRUCache.OptionsBase.allowStale} is false.
|
||||||
|
*
|
||||||
|
* Note: this returns an actual array, not a generator, so it can be more
|
||||||
|
* easily passed around.
|
||||||
*/
|
*/
|
||||||
dump() {
|
dump() {
|
||||||
const arr = [];
|
const arr = [];
|
||||||
@@ -38610,8 +38651,12 @@ var LRUCache = class _LRUCache {
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Reset the cache and load in the items in entries in the order listed.
|
* Reset the cache and load in the items in entries in the order listed.
|
||||||
* Note that the shape of the resulting cache may be different if the
|
*
|
||||||
* same options are not used in both caches.
|
* The shape of the resulting cache may be different if the same options are
|
||||||
|
* not used in both caches.
|
||||||
|
*
|
||||||
|
* The `start` fields are assumed to be calculated relative to a portable
|
||||||
|
* `Date.now()` timestamp, even if `performance.now()` is available.
|
||||||
*/
|
*/
|
||||||
load(arr) {
|
load(arr) {
|
||||||
this.clear();
|
this.clear();
|
||||||
@@ -38628,6 +38673,30 @@ var LRUCache = class _LRUCache {
|
|||||||
*
|
*
|
||||||
* Note: if `undefined` is specified as a value, this is an alias for
|
* Note: if `undefined` is specified as a value, this is an alias for
|
||||||
* {@link LRUCache#delete}
|
* {@link LRUCache#delete}
|
||||||
|
*
|
||||||
|
* Fields on the {@link LRUCache.SetOptions} options param will override
|
||||||
|
* their corresponding values in the constructor options for the scope
|
||||||
|
* of this single `set()` operation.
|
||||||
|
*
|
||||||
|
* If `start` is provided, then that will set the effective start
|
||||||
|
* time for the TTL calculation. Note that this must be a previous
|
||||||
|
* value of `performance.now()` if supported, or a previous value of
|
||||||
|
* `Date.now()` if not.
|
||||||
|
*
|
||||||
|
* Options object may also include `size`, which will prevent
|
||||||
|
* calling the `sizeCalculation` function and just use the specified
|
||||||
|
* number if it is a positive integer, and `noDisposeOnSet` which
|
||||||
|
* will prevent calling a `dispose` function in the case of
|
||||||
|
* overwrites.
|
||||||
|
*
|
||||||
|
* If the `size` (or return value of `sizeCalculation`) for a given
|
||||||
|
* entry is greater than `maxEntrySize`, then the item will not be
|
||||||
|
* added to the cache.
|
||||||
|
*
|
||||||
|
* Will update the recency of the entry.
|
||||||
|
*
|
||||||
|
* If the value is `undefined`, then this is an alias for
|
||||||
|
* `cache.delete(key)`. `undefined` is never stored in the cache.
|
||||||
*/
|
*/
|
||||||
set(k, v, setOptions = {}) {
|
set(k, v, setOptions = {}) {
|
||||||
if (v === void 0) {
|
if (v === void 0) {
|
||||||
@@ -38642,7 +38711,7 @@ var LRUCache = class _LRUCache {
|
|||||||
status.set = "miss";
|
status.set = "miss";
|
||||||
status.maxEntrySizeExceeded = true;
|
status.maxEntrySizeExceeded = true;
|
||||||
}
|
}
|
||||||
this.delete(k);
|
this.#delete(k, "set");
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
let index = this.#size === 0 ? void 0 : this.#keyMap.get(k);
|
let index = this.#size === 0 ? void 0 : this.#keyMap.get(k);
|
||||||
@@ -38776,6 +38845,14 @@ var LRUCache = class _LRUCache {
|
|||||||
* Will return false if the item is stale, even though it is technically
|
* Will return false if the item is stale, even though it is technically
|
||||||
* in the cache.
|
* in the cache.
|
||||||
*
|
*
|
||||||
|
* Check if a key is in the cache, without updating the recency of
|
||||||
|
* use. Age is updated if {@link LRUCache.OptionsBase.updateAgeOnHas} is set
|
||||||
|
* to `true` in either the options or the constructor.
|
||||||
|
*
|
||||||
|
* Will return `false` if the item is stale, even though it is technically in
|
||||||
|
* the cache. The difference can be determined (if it matters) by using a
|
||||||
|
* `status` argument, and inspecting the `has` field.
|
||||||
|
*
|
||||||
* Will not update item age unless
|
* Will not update item age unless
|
||||||
* {@link LRUCache.OptionsBase.updateAgeOnHas} is set.
|
* {@link LRUCache.OptionsBase.updateAgeOnHas} is set.
|
||||||
*/
|
*/
|
||||||
@@ -38858,7 +38935,7 @@ var LRUCache = class _LRUCache {
|
|||||||
if (bf2.__staleWhileFetching) {
|
if (bf2.__staleWhileFetching) {
|
||||||
this.#valList[index] = bf2.__staleWhileFetching;
|
this.#valList[index] = bf2.__staleWhileFetching;
|
||||||
} else {
|
} else {
|
||||||
this.delete(k);
|
this.#delete(k, "fetch");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (options.status)
|
if (options.status)
|
||||||
@@ -38884,7 +38961,7 @@ var LRUCache = class _LRUCache {
|
|||||||
if (this.#valList[index] === p) {
|
if (this.#valList[index] === p) {
|
||||||
const del = !noDelete || bf2.__staleWhileFetching === void 0;
|
const del = !noDelete || bf2.__staleWhileFetching === void 0;
|
||||||
if (del) {
|
if (del) {
|
||||||
this.delete(k);
|
this.#delete(k, "fetch");
|
||||||
} else if (!allowStaleAborted) {
|
} else if (!allowStaleAborted) {
|
||||||
this.#valList[index] = bf2.__staleWhileFetching;
|
this.#valList[index] = bf2.__staleWhileFetching;
|
||||||
}
|
}
|
||||||
@@ -39022,6 +39099,28 @@ var LRUCache = class _LRUCache {
|
|||||||
return staleVal ? p.__staleWhileFetching : p.__returned = p;
|
return staleVal ? p.__staleWhileFetching : p.__returned = p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
async forceFetch(k, fetchOptions = {}) {
|
||||||
|
const v = await this.fetch(k, fetchOptions);
|
||||||
|
if (v === void 0)
|
||||||
|
throw new Error("fetch() returned undefined");
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
memo(k, memoOptions = {}) {
|
||||||
|
const memoMethod = this.#memoMethod;
|
||||||
|
if (!memoMethod) {
|
||||||
|
throw new Error("no memoMethod provided to constructor");
|
||||||
|
}
|
||||||
|
const { context, forceRefresh, ...options } = memoOptions;
|
||||||
|
const v = this.get(k, options);
|
||||||
|
if (!forceRefresh && v !== void 0)
|
||||||
|
return v;
|
||||||
|
const vv = memoMethod(k, v, {
|
||||||
|
options,
|
||||||
|
context
|
||||||
|
});
|
||||||
|
this.set(k, vv, options);
|
||||||
|
return vv;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Return a value from the cache. Will update the recency of the cache
|
* Return a value from the cache. Will update the recency of the cache
|
||||||
* entry found.
|
* entry found.
|
||||||
@@ -39041,7 +39140,7 @@ var LRUCache = class _LRUCache {
|
|||||||
status.get = "stale";
|
status.get = "stale";
|
||||||
if (!fetching) {
|
if (!fetching) {
|
||||||
if (!noDeleteOnStaleGet) {
|
if (!noDeleteOnStaleGet) {
|
||||||
this.delete(k);
|
this.#delete(k, "expire");
|
||||||
}
|
}
|
||||||
if (status && allowStale)
|
if (status && allowStale)
|
||||||
status.returnedStale = true;
|
status.returnedStale = true;
|
||||||
@@ -39085,16 +39184,20 @@ var LRUCache = class _LRUCache {
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Deletes a key out of the cache.
|
* Deletes a key out of the cache.
|
||||||
|
*
|
||||||
* Returns true if the key was deleted, false otherwise.
|
* Returns true if the key was deleted, false otherwise.
|
||||||
*/
|
*/
|
||||||
delete(k) {
|
delete(k) {
|
||||||
|
return this.#delete(k, "delete");
|
||||||
|
}
|
||||||
|
#delete(k, reason) {
|
||||||
let deleted = false;
|
let deleted = false;
|
||||||
if (this.#size !== 0) {
|
if (this.#size !== 0) {
|
||||||
const index = this.#keyMap.get(k);
|
const index = this.#keyMap.get(k);
|
||||||
if (index !== void 0) {
|
if (index !== void 0) {
|
||||||
deleted = true;
|
deleted = true;
|
||||||
if (this.#size === 1) {
|
if (this.#size === 1) {
|
||||||
this.clear();
|
this.#clear(reason);
|
||||||
} else {
|
} else {
|
||||||
this.#removeItemSize(index);
|
this.#removeItemSize(index);
|
||||||
const v = this.#valList[index];
|
const v = this.#valList[index];
|
||||||
@@ -39102,10 +39205,10 @@ var LRUCache = class _LRUCache {
|
|||||||
v.__abortController.abort(new Error("deleted"));
|
v.__abortController.abort(new Error("deleted"));
|
||||||
} else if (this.#hasDispose || this.#hasDisposeAfter) {
|
} else if (this.#hasDispose || this.#hasDisposeAfter) {
|
||||||
if (this.#hasDispose) {
|
if (this.#hasDispose) {
|
||||||
this.#dispose?.(v, k, "delete");
|
this.#dispose?.(v, k, reason);
|
||||||
}
|
}
|
||||||
if (this.#hasDisposeAfter) {
|
if (this.#hasDisposeAfter) {
|
||||||
this.#disposed?.push([v, k, "delete"]);
|
this.#disposed?.push([v, k, reason]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.#keyMap.delete(k);
|
this.#keyMap.delete(k);
|
||||||
@@ -39139,6 +39242,9 @@ var LRUCache = class _LRUCache {
|
|||||||
* Clear the cache entirely, throwing away all values.
|
* Clear the cache entirely, throwing away all values.
|
||||||
*/
|
*/
|
||||||
clear() {
|
clear() {
|
||||||
|
return this.#clear("delete");
|
||||||
|
}
|
||||||
|
#clear(reason) {
|
||||||
for (const index of this.#rindexes({ allowStale: true })) {
|
for (const index of this.#rindexes({ allowStale: true })) {
|
||||||
const v = this.#valList[index];
|
const v = this.#valList[index];
|
||||||
if (this.#isBackgroundFetch(v)) {
|
if (this.#isBackgroundFetch(v)) {
|
||||||
@@ -39146,10 +39252,10 @@ var LRUCache = class _LRUCache {
|
|||||||
} else {
|
} else {
|
||||||
const k = this.#keyList[index];
|
const k = this.#keyList[index];
|
||||||
if (this.#hasDispose) {
|
if (this.#hasDispose) {
|
||||||
this.#dispose?.(v, k, "delete");
|
this.#dispose?.(v, k, reason);
|
||||||
}
|
}
|
||||||
if (this.#hasDisposeAfter) {
|
if (this.#hasDisposeAfter) {
|
||||||
this.#disposed?.push([v, k, "delete"]);
|
this.#disposed?.push([v, k, reason]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -39702,9 +39808,7 @@ async function main(appId2, privateKey2, owner2, repositories2, core3, createApp
|
|||||||
let parsedOwner = "";
|
let parsedOwner = "";
|
||||||
let parsedRepositoryNames = [];
|
let parsedRepositoryNames = [];
|
||||||
if (!owner2 && repositories2.length === 0) {
|
if (!owner2 && repositories2.length === 0) {
|
||||||
const [owner3, repo] = String(
|
const [owner3, repo] = String(process.env.GITHUB_REPOSITORY).split("/");
|
||||||
process.env.GITHUB_REPOSITORY
|
|
||||||
).split("/");
|
|
||||||
parsedOwner = owner3;
|
parsedOwner = owner3;
|
||||||
parsedRepositoryNames = [repo];
|
parsedRepositoryNames = [repo];
|
||||||
core3.info(
|
core3.info(
|
||||||
@@ -39721,14 +39825,18 @@ async function main(appId2, privateKey2, owner2, repositories2, core3, createApp
|
|||||||
parsedOwner = String(process.env.GITHUB_REPOSITORY_OWNER);
|
parsedOwner = String(process.env.GITHUB_REPOSITORY_OWNER);
|
||||||
parsedRepositoryNames = repositories2;
|
parsedRepositoryNames = repositories2;
|
||||||
core3.info(
|
core3.info(
|
||||||
`owner not set, creating owner for given repositories "${repositories2.join(",")}" in current owner ("${parsedOwner}")`
|
`owner not set, creating owner for given repositories "${repositories2.join(
|
||||||
|
","
|
||||||
|
)}" in current owner ("${parsedOwner}")`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (owner2 && repositories2.length > 0) {
|
if (owner2 && repositories2.length > 0) {
|
||||||
parsedOwner = owner2;
|
parsedOwner = owner2;
|
||||||
parsedRepositoryNames = repositories2;
|
parsedRepositoryNames = repositories2;
|
||||||
core3.info(
|
core3.info(
|
||||||
`owner and repositories set, creating token for repositories "${repositories2.join(",")}" owned by "${owner2}"`
|
`owner and repositories set, creating token for repositories "${repositories2.join(
|
||||||
|
","
|
||||||
|
)}" owned by "${owner2}"`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const auth5 = createAppAuth2({
|
const auth5 = createAppAuth2({
|
||||||
@@ -39738,23 +39846,36 @@ async function main(appId2, privateKey2, owner2, repositories2, core3, createApp
|
|||||||
});
|
});
|
||||||
let authentication, installationId, appSlug;
|
let authentication, installationId, appSlug;
|
||||||
if (parsedRepositoryNames.length > 0) {
|
if (parsedRepositoryNames.length > 0) {
|
||||||
({ authentication, installationId, appSlug } = await pRetry(() => getTokenFromRepository(request2, auth5, parsedOwner, parsedRepositoryNames), {
|
({ authentication, installationId, appSlug } = await pRetry(
|
||||||
onFailedAttempt: (error) => {
|
() => getTokenFromRepository(
|
||||||
core3.info(
|
request2,
|
||||||
`Failed to create token for "${parsedRepositoryNames.join(",")}" (attempt ${error.attemptNumber}): ${error.message}`
|
auth5,
|
||||||
);
|
parsedOwner,
|
||||||
},
|
parsedRepositoryNames
|
||||||
retries: 3
|
),
|
||||||
}));
|
{
|
||||||
|
onFailedAttempt: (error) => {
|
||||||
|
core3.info(
|
||||||
|
`Failed to create token for "${parsedRepositoryNames.join(
|
||||||
|
","
|
||||||
|
)}" (attempt ${error.attemptNumber}): ${error.message}`
|
||||||
|
);
|
||||||
|
},
|
||||||
|
retries: 3
|
||||||
|
}
|
||||||
|
));
|
||||||
} else {
|
} else {
|
||||||
({ authentication, installationId, appSlug } = await pRetry(() => getTokenFromOwner(request2, auth5, parsedOwner), {
|
({ authentication, installationId, appSlug } = await pRetry(
|
||||||
onFailedAttempt: (error) => {
|
() => getTokenFromOwner(request2, auth5, parsedOwner),
|
||||||
core3.info(
|
{
|
||||||
`Failed to create token for "${parsedOwner}" (attempt ${error.attemptNumber}): ${error.message}`
|
onFailedAttempt: (error) => {
|
||||||
);
|
core3.info(
|
||||||
},
|
`Failed to create token for "${parsedOwner}" (attempt ${error.attemptNumber}): ${error.message}`
|
||||||
retries: 3
|
);
|
||||||
}));
|
},
|
||||||
|
retries: 3
|
||||||
|
}
|
||||||
|
));
|
||||||
}
|
}
|
||||||
core3.setSecret(authentication.token);
|
core3.setSecret(authentication.token);
|
||||||
core3.setOutput("token", authentication.token);
|
core3.setOutput("token", authentication.token);
|
||||||
@@ -39766,19 +39887,11 @@ async function main(appId2, privateKey2, owner2, repositories2, core3, createApp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
async function getTokenFromOwner(request2, auth5, parsedOwner) {
|
async function getTokenFromOwner(request2, auth5, parsedOwner) {
|
||||||
const response = await request2("GET /orgs/{org}/installation", {
|
const response = await request2("GET /users/{username}/installation", {
|
||||||
org: parsedOwner,
|
username: parsedOwner,
|
||||||
request: {
|
request: {
|
||||||
hook: auth5.hook
|
hook: auth5.hook
|
||||||
}
|
}
|
||||||
}).catch((error) => {
|
|
||||||
if (error.status !== 404) throw error;
|
|
||||||
return request2("GET /users/{username}/installation", {
|
|
||||||
username: parsedOwner,
|
|
||||||
request: {
|
|
||||||
hook: auth5.hook
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
const authentication = await auth5({
|
const authentication = await auth5({
|
||||||
type: "installation",
|
type: "installation",
|
||||||
|
|||||||
Vendored
+20
-7
@@ -560,10 +560,10 @@ var require_proxy = __commonJS({
|
|||||||
})();
|
})();
|
||||||
if (proxyVar) {
|
if (proxyVar) {
|
||||||
try {
|
try {
|
||||||
return new URL(proxyVar);
|
return new DecodedURL(proxyVar);
|
||||||
} catch (_a) {
|
} catch (_a) {
|
||||||
if (!proxyVar.startsWith("http://") && !proxyVar.startsWith("https://"))
|
if (!proxyVar.startsWith("http://") && !proxyVar.startsWith("https://"))
|
||||||
return new URL(`http://${proxyVar}`);
|
return new DecodedURL(`http://${proxyVar}`);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return void 0;
|
return void 0;
|
||||||
@@ -606,6 +606,19 @@ var require_proxy = __commonJS({
|
|||||||
const hostLower = host.toLowerCase();
|
const hostLower = host.toLowerCase();
|
||||||
return hostLower === "localhost" || hostLower.startsWith("127.") || hostLower.startsWith("[::1]") || hostLower.startsWith("[0:0:0:0:0:0:0:1]");
|
return hostLower === "localhost" || hostLower.startsWith("127.") || hostLower.startsWith("[::1]") || hostLower.startsWith("[0:0:0:0:0:0:0:1]");
|
||||||
}
|
}
|
||||||
|
var DecodedURL = class extends URL {
|
||||||
|
constructor(url, base) {
|
||||||
|
super(url, base);
|
||||||
|
this._decodedUsername = decodeURIComponent(super.username);
|
||||||
|
this._decodedPassword = decodeURIComponent(super.password);
|
||||||
|
}
|
||||||
|
get username() {
|
||||||
|
return this._decodedUsername;
|
||||||
|
}
|
||||||
|
get password() {
|
||||||
|
return this._decodedPassword;
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -18140,7 +18153,7 @@ var require_lib = __commonJS({
|
|||||||
}
|
}
|
||||||
const usingSsl = parsedUrl.protocol === "https:";
|
const usingSsl = parsedUrl.protocol === "https:";
|
||||||
proxyAgent = new undici_1.ProxyAgent(Object.assign({ uri: proxyUrl2.href, pipelining: !this._keepAlive ? 0 : 1 }, (proxyUrl2.username || proxyUrl2.password) && {
|
proxyAgent = new undici_1.ProxyAgent(Object.assign({ uri: proxyUrl2.href, pipelining: !this._keepAlive ? 0 : 1 }, (proxyUrl2.username || proxyUrl2.password) && {
|
||||||
token: `${proxyUrl2.username}:${proxyUrl2.password}`
|
token: `Basic ${Buffer.from(`${proxyUrl2.username}:${proxyUrl2.password}`).toString("base64")}`
|
||||||
}));
|
}));
|
||||||
this._proxyAgentDispatcher = proxyAgent;
|
this._proxyAgentDispatcher = proxyAgent;
|
||||||
if (usingSsl && this._ignoreSslError) {
|
if (usingSsl && this._ignoreSslError) {
|
||||||
@@ -36791,11 +36804,11 @@ var RequestError = class extends Error {
|
|||||||
response;
|
response;
|
||||||
constructor(message, statusCode, options) {
|
constructor(message, statusCode, options) {
|
||||||
super(message);
|
super(message);
|
||||||
if (Error.captureStackTrace) {
|
|
||||||
Error.captureStackTrace(this, this.constructor);
|
|
||||||
}
|
|
||||||
this.name = "HttpError";
|
this.name = "HttpError";
|
||||||
this.status = statusCode;
|
this.status = Number.parseInt(statusCode);
|
||||||
|
if (Number.isNaN(this.status)) {
|
||||||
|
this.status = 0;
|
||||||
|
}
|
||||||
if ("response" in options) {
|
if ("response" in options) {
|
||||||
this.response = options.response;
|
this.response = options.response;
|
||||||
}
|
}
|
||||||
|
|||||||
+49
-38
@@ -26,9 +26,7 @@ export async function main(
|
|||||||
|
|
||||||
// If neither owner nor repositories are set, default to current repository
|
// If neither owner nor repositories are set, default to current repository
|
||||||
if (!owner && repositories.length === 0) {
|
if (!owner && repositories.length === 0) {
|
||||||
const [owner, repo] = String(
|
const [owner, repo] = String(process.env.GITHUB_REPOSITORY).split("/");
|
||||||
process.env.GITHUB_REPOSITORY
|
|
||||||
).split("/");
|
|
||||||
parsedOwner = owner;
|
parsedOwner = owner;
|
||||||
parsedRepositoryNames = [repo];
|
parsedRepositoryNames = [repo];
|
||||||
|
|
||||||
@@ -52,7 +50,9 @@ export async function main(
|
|||||||
parsedRepositoryNames = repositories;
|
parsedRepositoryNames = repositories;
|
||||||
|
|
||||||
core.info(
|
core.info(
|
||||||
`owner not set, creating owner for given repositories "${repositories.join(',')}" in current owner ("${parsedOwner}")`
|
`owner not set, creating owner for given repositories "${repositories.join(
|
||||||
|
","
|
||||||
|
)}" in current owner ("${parsedOwner}")`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,7 +62,9 @@ export async function main(
|
|||||||
parsedRepositoryNames = repositories;
|
parsedRepositoryNames = repositories;
|
||||||
|
|
||||||
core.info(
|
core.info(
|
||||||
`owner and repositories set, creating token for repositories "${repositories.join(',')}" owned by "${owner}"`
|
`owner and repositories set, creating token for repositories "${repositories.join(
|
||||||
|
","
|
||||||
|
)}" owned by "${owner}"`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,24 +78,38 @@ export async function main(
|
|||||||
// If at least one repository is set, get installation ID from that repository
|
// If at least one repository is set, get installation ID from that repository
|
||||||
|
|
||||||
if (parsedRepositoryNames.length > 0) {
|
if (parsedRepositoryNames.length > 0) {
|
||||||
({ authentication, installationId, appSlug } = await pRetry(() => getTokenFromRepository(request, auth, parsedOwner, parsedRepositoryNames), {
|
({ authentication, installationId, appSlug } = await pRetry(
|
||||||
onFailedAttempt: (error) => {
|
() =>
|
||||||
core.info(
|
getTokenFromRepository(
|
||||||
`Failed to create token for "${parsedRepositoryNames.join(',')}" (attempt ${error.attemptNumber}): ${error.message}`
|
request,
|
||||||
);
|
auth,
|
||||||
},
|
parsedOwner,
|
||||||
retries: 3,
|
parsedRepositoryNames
|
||||||
}));
|
),
|
||||||
|
{
|
||||||
|
onFailedAttempt: (error) => {
|
||||||
|
core.info(
|
||||||
|
`Failed to create token for "${parsedRepositoryNames.join(
|
||||||
|
","
|
||||||
|
)}" (attempt ${error.attemptNumber}): ${error.message}`
|
||||||
|
);
|
||||||
|
},
|
||||||
|
retries: 3,
|
||||||
|
}
|
||||||
|
));
|
||||||
} else {
|
} else {
|
||||||
// Otherwise get the installation for the owner, which can either be an organization or a user account
|
// Otherwise get the installation for the owner, which can either be an organization or a user account
|
||||||
({ authentication, installationId, appSlug } = await pRetry(() => getTokenFromOwner(request, auth, parsedOwner), {
|
({ authentication, installationId, appSlug } = await pRetry(
|
||||||
onFailedAttempt: (error) => {
|
() => getTokenFromOwner(request, auth, parsedOwner),
|
||||||
core.info(
|
{
|
||||||
`Failed to create token for "${parsedOwner}" (attempt ${error.attemptNumber}): ${error.message}`
|
onFailedAttempt: (error) => {
|
||||||
);
|
core.info(
|
||||||
},
|
`Failed to create token for "${parsedOwner}" (attempt ${error.attemptNumber}): ${error.message}`
|
||||||
retries: 3,
|
);
|
||||||
}));
|
},
|
||||||
|
retries: 3,
|
||||||
|
}
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Register the token with the runner as a secret to ensure it is masked in logs
|
// Register the token with the runner as a secret to ensure it is masked in logs
|
||||||
@@ -111,23 +127,13 @@ export async function main(
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function getTokenFromOwner(request, auth, parsedOwner) {
|
async function getTokenFromOwner(request, auth, parsedOwner) {
|
||||||
// https://docs.github.com/en/rest/apps/apps?apiVersion=2022-11-28#get-an-organization-installation-for-the-authenticated-app
|
// https://docs.github.com/rest/apps/apps?apiVersion=2022-11-28#get-a-user-installation-for-the-authenticated-app
|
||||||
const response = await request("GET /orgs/{org}/installation", {
|
// This endpoint works for both users and organizations
|
||||||
org: parsedOwner,
|
const response = await request("GET /users/{username}/installation", {
|
||||||
|
username: parsedOwner,
|
||||||
request: {
|
request: {
|
||||||
hook: auth.hook,
|
hook: auth.hook,
|
||||||
},
|
},
|
||||||
}).catch((error) => {
|
|
||||||
/* c8 ignore next */
|
|
||||||
if (error.status !== 404) throw error;
|
|
||||||
|
|
||||||
// https://docs.github.com/rest/apps/apps?apiVersion=2022-11-28#get-a-user-installation-for-the-authenticated-app
|
|
||||||
return request("GET /users/{username}/installation", {
|
|
||||||
username: parsedOwner,
|
|
||||||
request: {
|
|
||||||
hook: auth.hook,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Get token for for all repositories of the given installation
|
// Get token for for all repositories of the given installation
|
||||||
@@ -137,12 +143,17 @@ async function getTokenFromOwner(request, auth, parsedOwner) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const installationId = response.data.id;
|
const installationId = response.data.id;
|
||||||
const appSlug = response.data['app_slug'];
|
const appSlug = response.data["app_slug"];
|
||||||
|
|
||||||
return { authentication, installationId, appSlug };
|
return { authentication, installationId, appSlug };
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getTokenFromRepository(request, auth, parsedOwner, parsedRepositoryNames) {
|
async function getTokenFromRepository(
|
||||||
|
request,
|
||||||
|
auth,
|
||||||
|
parsedOwner,
|
||||||
|
parsedRepositoryNames
|
||||||
|
) {
|
||||||
// https://docs.github.com/rest/apps/apps?apiVersion=2022-11-28#get-a-repository-installation-for-the-authenticated-app
|
// https://docs.github.com/rest/apps/apps?apiVersion=2022-11-28#get-a-repository-installation-for-the-authenticated-app
|
||||||
const response = await request("GET /repos/{owner}/{repo}/installation", {
|
const response = await request("GET /repos/{owner}/{repo}/installation", {
|
||||||
owner: parsedOwner,
|
owner: parsedOwner,
|
||||||
@@ -160,7 +171,7 @@ async function getTokenFromRepository(request, auth, parsedOwner, parsedReposito
|
|||||||
});
|
});
|
||||||
|
|
||||||
const installationId = response.data.id;
|
const installationId = response.data.id;
|
||||||
const appSlug = response.data['app_slug'];
|
const appSlug = response.data["app_slug"];
|
||||||
|
|
||||||
return { authentication, installationId, appSlug };
|
return { authentication, installationId, appSlug };
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -1,6 +1,6 @@
|
|||||||
import { test } from "./main.js";
|
import { test } from "./main.js";
|
||||||
|
|
||||||
// Verify `main` successfully obtains a token when the `owner` input is set (to a user), but the `repositories` input isn’t set.
|
// Verify retries work when getting a token for a user or organization fails on the first attempt.
|
||||||
await test((mockPool) => {
|
await test((mockPool) => {
|
||||||
process.env.INPUT_OWNER = "smockle";
|
process.env.INPUT_OWNER = "smockle";
|
||||||
delete process.env.INPUT_REPOSITORIES;
|
delete process.env.INPUT_REPOSITORIES;
|
||||||
@@ -10,7 +10,7 @@ await test((mockPool) => {
|
|||||||
const mockAppSlug = "github-actions";
|
const mockAppSlug = "github-actions";
|
||||||
mockPool
|
mockPool
|
||||||
.intercept({
|
.intercept({
|
||||||
path: `/orgs/${process.env.INPUT_OWNER}/installation`,
|
path: `/users/${process.env.INPUT_OWNER}/installation`,
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
accept: "application/vnd.github.v3+json",
|
accept: "application/vnd.github.v3+json",
|
||||||
@@ -18,7 +18,7 @@ await test((mockPool) => {
|
|||||||
// Intentionally omitting the `authorization` header, since JWT creation is not idempotent.
|
// Intentionally omitting the `authorization` header, since JWT creation is not idempotent.
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.reply(404);
|
.reply(500, "GitHub API not available");
|
||||||
mockPool
|
mockPool
|
||||||
.intercept({
|
.intercept({
|
||||||
path: `/users/${process.env.INPUT_OWNER}/installation`,
|
path: `/users/${process.env.INPUT_OWNER}/installation`,
|
||||||
@@ -31,7 +31,7 @@ await test((mockPool) => {
|
|||||||
})
|
})
|
||||||
.reply(
|
.reply(
|
||||||
200,
|
200,
|
||||||
{ id: mockInstallationId, "app_slug": mockAppSlug },
|
{ id: mockInstallationId, app_slug: mockAppSlug },
|
||||||
{ headers: { "content-type": "application/json" } }
|
{ headers: { "content-type": "application/json" } }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
+4
-4
@@ -1,16 +1,16 @@
|
|||||||
import { test } from "./main.js";
|
import { test } from "./main.js";
|
||||||
|
|
||||||
// Verify `main` successfully obtains a token when the `owner` input is set (to an org), but the `repositories` input isn’t set.
|
// Verify `main` successfully obtains a token when the `owner` input is set, and the `repositories` input isn’t set.
|
||||||
await test((mockPool) => {
|
await test((mockPool) => {
|
||||||
process.env.INPUT_OWNER = process.env.GITHUB_REPOSITORY_OWNER;
|
process.env.INPUT_OWNER = process.env.GITHUB_REPOSITORY_OWNER;
|
||||||
delete process.env.INPUT_REPOSITORIES;
|
delete process.env.INPUT_REPOSITORIES;
|
||||||
|
|
||||||
// Mock installation id and app slug request
|
// Mock installation ID and app slug request
|
||||||
const mockInstallationId = "123456";
|
const mockInstallationId = "123456";
|
||||||
const mockAppSlug = "github-actions";
|
const mockAppSlug = "github-actions";
|
||||||
mockPool
|
mockPool
|
||||||
.intercept({
|
.intercept({
|
||||||
path: `/orgs/${process.env.INPUT_OWNER}/installation`,
|
path: `/users/${process.env.INPUT_OWNER}/installation`,
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
accept: "application/vnd.github.v3+json",
|
accept: "application/vnd.github.v3+json",
|
||||||
@@ -20,7 +20,7 @@ await test((mockPool) => {
|
|||||||
})
|
})
|
||||||
.reply(
|
.reply(
|
||||||
200,
|
200,
|
||||||
{ id: mockInstallationId, "app_slug": mockAppSlug },
|
{ id: mockInstallationId, app_slug: mockAppSlug },
|
||||||
{ headers: { "content-type": "application/json" } }
|
{ headers: { "content-type": "application/json" } }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
import { test } from "./main.js";
|
|
||||||
|
|
||||||
// Verify `main` successfully obtains a token when the `owner` input is set (to a user), but the `repositories` input isn’t set.
|
|
||||||
await test((mockPool) => {
|
|
||||||
process.env.INPUT_OWNER = "smockle";
|
|
||||||
delete process.env.INPUT_REPOSITORIES;
|
|
||||||
|
|
||||||
// Mock installation ID and app slug request
|
|
||||||
const mockInstallationId = "123456";
|
|
||||||
const mockAppSlug = "github-actions";
|
|
||||||
mockPool
|
|
||||||
.intercept({
|
|
||||||
path: `/orgs/${process.env.INPUT_OWNER}/installation`,
|
|
||||||
method: "GET",
|
|
||||||
headers: {
|
|
||||||
accept: "application/vnd.github.v3+json",
|
|
||||||
"user-agent": "actions/create-github-app-token",
|
|
||||||
// Intentionally omitting the `authorization` header, since JWT creation is not idempotent.
|
|
||||||
},
|
|
||||||
})
|
|
||||||
.reply(500, "GitHub API not available");
|
|
||||||
mockPool
|
|
||||||
.intercept({
|
|
||||||
path: `/orgs/${process.env.INPUT_OWNER}/installation`,
|
|
||||||
method: "GET",
|
|
||||||
headers: {
|
|
||||||
accept: "application/vnd.github.v3+json",
|
|
||||||
"user-agent": "actions/create-github-app-token",
|
|
||||||
// Intentionally omitting the `authorization` header, since JWT creation is not idempotent.
|
|
||||||
},
|
|
||||||
})
|
|
||||||
.reply(
|
|
||||||
200,
|
|
||||||
{ id: mockInstallationId, "app_slug": mockAppSlug },
|
|
||||||
{ headers: { "content-type": "application/json" } }
|
|
||||||
);
|
|
||||||
});
|
|
||||||
+21
-40
@@ -114,6 +114,26 @@ Generated by [AVA](https://avajs.dev).
|
|||||||
::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
|
::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
|
||||||
::save-state name=expiresAt::2016-07-11T22:14:10Z`
|
::save-state name=expiresAt::2016-07-11T22:14:10Z`
|
||||||
|
|
||||||
|
## main-token-get-owner-set-fail-response.test.js
|
||||||
|
|
||||||
|
> stderr
|
||||||
|
|
||||||
|
''
|
||||||
|
|
||||||
|
> stdout
|
||||||
|
|
||||||
|
`repositories not set, creating token for all repositories for given owner "smockle"␊
|
||||||
|
Failed to create token for "smockle" (attempt 1): GitHub API not available␊
|
||||||
|
::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
|
||||||
|
␊
|
||||||
|
::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
|
||||||
|
␊
|
||||||
|
::set-output name=installation-id::123456␊
|
||||||
|
␊
|
||||||
|
::set-output name=app-slug::github-actions␊
|
||||||
|
::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
|
||||||
|
::save-state name=expiresAt::2016-07-11T22:14:10Z`
|
||||||
|
|
||||||
## main-token-get-owner-set-repo-fail-response.test.js
|
## main-token-get-owner-set-repo-fail-response.test.js
|
||||||
|
|
||||||
> stderr
|
> stderr
|
||||||
@@ -191,7 +211,7 @@ Generated by [AVA](https://avajs.dev).
|
|||||||
::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
|
::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
|
||||||
::save-state name=expiresAt::2016-07-11T22:14:10Z`
|
::save-state name=expiresAt::2016-07-11T22:14:10Z`
|
||||||
|
|
||||||
## main-token-get-owner-set-to-org-repo-unset.test.js
|
## main-token-get-owner-set-repo-unset.test.js
|
||||||
|
|
||||||
> stderr
|
> stderr
|
||||||
|
|
||||||
@@ -210,45 +230,6 @@ Generated by [AVA](https://avajs.dev).
|
|||||||
::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
|
::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
|
||||||
::save-state name=expiresAt::2016-07-11T22:14:10Z`
|
::save-state name=expiresAt::2016-07-11T22:14:10Z`
|
||||||
|
|
||||||
## main-token-get-owner-set-to-user-fail-response.test.js
|
|
||||||
|
|
||||||
> stderr
|
|
||||||
|
|
||||||
''
|
|
||||||
|
|
||||||
> stdout
|
|
||||||
|
|
||||||
`repositories not set, creating token for all repositories for given owner "smockle"␊
|
|
||||||
Failed to create token for "smockle" (attempt 1): GitHub API not available␊
|
|
||||||
::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
|
|
||||||
␊
|
|
||||||
::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
|
|
||||||
␊
|
|
||||||
::set-output name=installation-id::123456␊
|
|
||||||
␊
|
|
||||||
::set-output name=app-slug::github-actions␊
|
|
||||||
::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
|
|
||||||
::save-state name=expiresAt::2016-07-11T22:14:10Z`
|
|
||||||
|
|
||||||
## main-token-get-owner-set-to-user-repo-unset.test.js
|
|
||||||
|
|
||||||
> stderr
|
|
||||||
|
|
||||||
''
|
|
||||||
|
|
||||||
> stdout
|
|
||||||
|
|
||||||
`repositories not set, creating token for all repositories for given owner "smockle"␊
|
|
||||||
::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
|
|
||||||
␊
|
|
||||||
::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
|
|
||||||
␊
|
|
||||||
::set-output name=installation-id::123456␊
|
|
||||||
␊
|
|
||||||
::set-output name=app-slug::github-actions␊
|
|
||||||
::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
|
|
||||||
::save-state name=expiresAt::2016-07-11T22:14:10Z`
|
|
||||||
|
|
||||||
## main-token-get-owner-unset-repo-set.test.js
|
## main-token-get-owner-unset-repo-set.test.js
|
||||||
|
|
||||||
> stderr
|
> stderr
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user