From d311c20745418f06c5b609b154918ee2a9a707f7 Mon Sep 17 00:00:00 2001 From: "korosuke613-action-release-app[bot]" <147311827+korosuke613-action-release-app[bot]@users.noreply.github.com> Date: Sat, 11 Nov 2023 11:30:25 +0000 Subject: [PATCH] chore(main): release 2.1.4 --- CHANGELOG.md | 7 +++++++ dist/index.js | 48 +++++++++++++++++++++++++++++++++++------------ dist/pre.js | 44 +++++++++++++++++++++++++++++++------------ package-lock.json | 4 ++-- package.json | 2 +- 5 files changed, 78 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f0236241..ad819ef2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [2.1.4](https://github.com/korosuke613/zenn-metadata-updater-action/compare/v2.1.3...v2.1.4) (2023-11-11) + + +### Bug Fixes + +* don't overwriting published_at in markdown ([dee3156](https://github.com/korosuke613/zenn-metadata-updater-action/commit/dee31564f8affded0d1f5ab77b0bebadb75f09c2)) + ## [2.1.3](https://github.com/korosuke613/zenn-metadata-updater-action/compare/v2.1.2...v2.1.3) (2023-10-09) diff --git a/dist/index.js b/dist/index.js index e1f91d4b..53420c9c 100644 --- a/dist/index.js +++ b/dist/index.js @@ -18527,6 +18527,7 @@ module.exports = { const assert = __nccwpck_require__(9491) const net = __nccwpck_require__(1808) +const http = __nccwpck_require__(3685) const { pipeline } = __nccwpck_require__(2781) const util = __nccwpck_require__(3983) const timers = __nccwpck_require__(9459) @@ -18614,6 +18615,7 @@ const { HTTP2_HEADER_AUTHORITY, HTTP2_HEADER_METHOD, HTTP2_HEADER_PATH, + HTTP2_HEADER_SCHEME, HTTP2_HEADER_CONTENT_LENGTH, HTTP2_HEADER_EXPECT, HTTP2_HEADER_STATUS @@ -18790,7 +18792,7 @@ class Client extends DispatcherBase { this[kConnector] = connect this[kSocket] = null this[kPipelining] = pipelining != null ? pipelining : 1 - this[kMaxHeadersSize] = maxHeaderSize || 16384 + this[kMaxHeadersSize] = maxHeaderSize || http.maxHeaderSize this[kKeepAliveDefaultTimeout] = keepAliveTimeout == null ? 4e3 : keepAliveTimeout this[kKeepAliveMaxTimeout] = keepAliveMaxTimeout == null ? 600e3 : keepAliveMaxTimeout this[kKeepAliveTimeoutThreshold] = keepAliveTimeoutThreshold == null ? 1e3 : keepAliveTimeoutThreshold @@ -20210,7 +20212,7 @@ function writeH2 (client, session, request) { const h2State = client[kHTTP2SessionState] headers[HTTP2_HEADER_AUTHORITY] = host || client[kHost] - headers[HTTP2_HEADER_PATH] = path + headers[HTTP2_HEADER_METHOD] = method if (method === 'CONNECT') { session.ref() @@ -20237,10 +20239,14 @@ function writeH2 (client, session, request) { }) return true - } else { - headers[HTTP2_HEADER_METHOD] = method } + // https://tools.ietf.org/html/rfc7540#section-8.3 + // :path and :scheme headers must be omited when sending CONNECT + + headers[HTTP2_HEADER_PATH] = path + headers[HTTP2_HEADER_SCHEME] = 'https' + // https://tools.ietf.org/html/rfc7231#section-4.3.1 // https://tools.ietf.org/html/rfc7231#section-4.3.2 // https://tools.ietf.org/html/rfc7231#section-4.3.5 @@ -20377,6 +20383,7 @@ function writeH2 (client, session, request) { stream.cork() stream.write(body) stream.uncork() + stream.end() request.onBodySent(body) request.onRequestSent() } else if (util.isBlobLike(body)) { @@ -20611,13 +20618,17 @@ async function writeIterable ({ h2stream, body, client, request, socket, content throw socket[kError] } - if (!h2stream.write(chunk)) { + const res = h2stream.write(chunk) + request.onBodySent(chunk) + if (!res) { await waitForDrain() } } } catch (err) { h2stream.destroy(err) } finally { + request.onRequestSent() + h2stream.end() h2stream .off('close', onDrain) .off('drain', onDrain) @@ -20830,11 +20841,13 @@ class CompatFinalizer { } register (dispatcher, key) { - dispatcher.on('disconnect', () => { - if (dispatcher[kConnected] === 0 && dispatcher[kSize] === 0) { - this.finalizer(key) - } - }) + if (dispatcher.on) { + dispatcher.on('disconnect', () => { + if (dispatcher[kConnected] === 0 && dispatcher[kSize] === 0) { + this.finalizer(key) + } + }) + } } } @@ -22500,7 +22513,8 @@ function processHeader (request, key, val, skipAppend = false) { key.toLowerCase() === 'content-type' ) { request.contentType = val - request.headers += processHeaderValue(key, val) + if (skipAppend) request.headers[key] = processHeaderValue(key, val, skipAppend) + else request.headers += processHeaderValue(key, val) } else if ( key.length === 17 && key.toLowerCase() === 'transfer-encoding' @@ -27190,6 +27204,10 @@ async function httpRedirectFetch (fetchParams, response) { if (!sameOrigin(requestCurrentURL(request), locationURL)) { // https://fetch.spec.whatwg.org/#cors-non-wildcard-request-header-name request.headersList.delete('authorization') + + // "Cookie" and "Host" are forbidden request-headers, which undici doesn't implement. + request.headersList.delete('cookie') + request.headersList.delete('host') } // 14. If request’s body is non-null, then set request’s body to the first return @@ -27334,7 +27352,7 @@ async function httpNetworkOrCacheFetch ( // user agents should append `User-Agent`/default `User-Agent` value to // httpRequest’s header list. if (!httpRequest.headersList.contains('user-agent')) { - httpRequest.headersList.append('user-agent', 'undici') + httpRequest.headersList.append('user-agent', typeof esbuildDetection === 'undefined' ? 'undici' : 'node') } // 15. If httpRequest’s cache mode is "default" and httpRequest’s header @@ -27396,6 +27414,8 @@ async function httpNetworkOrCacheFetch ( } } + httpRequest.headersList.delete('host') + // 20. If includeCredentials is true, then: if (includeCredentials) { // 1. If the user agent is not configured to block cookies for httpRequest @@ -42087,6 +42107,10 @@ function updateZennMetadata(updater, updateParams) { for (const [key, value] of Object.entries(updateParams)) { if (value === "" || value === undefined) continue; + const publishedAtKey = "published_at"; + // もしすでに `published_at` が設定されていたら更新しない + if (key === publishedAtKey && metadata.published_at !== undefined) + continue; metadata[key] = value; } (0, core_1.debug)(`updated metadata: ${JSON.stringify(metadata, null, 2)}`); diff --git a/dist/pre.js b/dist/pre.js index 8a031698..9c0ddc1e 100644 --- a/dist/pre.js +++ b/dist/pre.js @@ -6476,6 +6476,7 @@ module.exports = { const assert = __nccwpck_require__(9491) const net = __nccwpck_require__(1808) +const http = __nccwpck_require__(3685) const { pipeline } = __nccwpck_require__(2781) const util = __nccwpck_require__(3983) const timers = __nccwpck_require__(9459) @@ -6563,6 +6564,7 @@ const { HTTP2_HEADER_AUTHORITY, HTTP2_HEADER_METHOD, HTTP2_HEADER_PATH, + HTTP2_HEADER_SCHEME, HTTP2_HEADER_CONTENT_LENGTH, HTTP2_HEADER_EXPECT, HTTP2_HEADER_STATUS @@ -6739,7 +6741,7 @@ class Client extends DispatcherBase { this[kConnector] = connect this[kSocket] = null this[kPipelining] = pipelining != null ? pipelining : 1 - this[kMaxHeadersSize] = maxHeaderSize || 16384 + this[kMaxHeadersSize] = maxHeaderSize || http.maxHeaderSize this[kKeepAliveDefaultTimeout] = keepAliveTimeout == null ? 4e3 : keepAliveTimeout this[kKeepAliveMaxTimeout] = keepAliveMaxTimeout == null ? 600e3 : keepAliveMaxTimeout this[kKeepAliveTimeoutThreshold] = keepAliveTimeoutThreshold == null ? 1e3 : keepAliveTimeoutThreshold @@ -8159,7 +8161,7 @@ function writeH2 (client, session, request) { const h2State = client[kHTTP2SessionState] headers[HTTP2_HEADER_AUTHORITY] = host || client[kHost] - headers[HTTP2_HEADER_PATH] = path + headers[HTTP2_HEADER_METHOD] = method if (method === 'CONNECT') { session.ref() @@ -8186,10 +8188,14 @@ function writeH2 (client, session, request) { }) return true - } else { - headers[HTTP2_HEADER_METHOD] = method } + // https://tools.ietf.org/html/rfc7540#section-8.3 + // :path and :scheme headers must be omited when sending CONNECT + + headers[HTTP2_HEADER_PATH] = path + headers[HTTP2_HEADER_SCHEME] = 'https' + // https://tools.ietf.org/html/rfc7231#section-4.3.1 // https://tools.ietf.org/html/rfc7231#section-4.3.2 // https://tools.ietf.org/html/rfc7231#section-4.3.5 @@ -8326,6 +8332,7 @@ function writeH2 (client, session, request) { stream.cork() stream.write(body) stream.uncork() + stream.end() request.onBodySent(body) request.onRequestSent() } else if (util.isBlobLike(body)) { @@ -8560,13 +8567,17 @@ async function writeIterable ({ h2stream, body, client, request, socket, content throw socket[kError] } - if (!h2stream.write(chunk)) { + const res = h2stream.write(chunk) + request.onBodySent(chunk) + if (!res) { await waitForDrain() } } } catch (err) { h2stream.destroy(err) } finally { + request.onRequestSent() + h2stream.end() h2stream .off('close', onDrain) .off('drain', onDrain) @@ -8779,11 +8790,13 @@ class CompatFinalizer { } register (dispatcher, key) { - dispatcher.on('disconnect', () => { - if (dispatcher[kConnected] === 0 && dispatcher[kSize] === 0) { - this.finalizer(key) - } - }) + if (dispatcher.on) { + dispatcher.on('disconnect', () => { + if (dispatcher[kConnected] === 0 && dispatcher[kSize] === 0) { + this.finalizer(key) + } + }) + } } } @@ -10449,7 +10462,8 @@ function processHeader (request, key, val, skipAppend = false) { key.toLowerCase() === 'content-type' ) { request.contentType = val - request.headers += processHeaderValue(key, val) + if (skipAppend) request.headers[key] = processHeaderValue(key, val, skipAppend) + else request.headers += processHeaderValue(key, val) } else if ( key.length === 17 && key.toLowerCase() === 'transfer-encoding' @@ -15139,6 +15153,10 @@ async function httpRedirectFetch (fetchParams, response) { if (!sameOrigin(requestCurrentURL(request), locationURL)) { // https://fetch.spec.whatwg.org/#cors-non-wildcard-request-header-name request.headersList.delete('authorization') + + // "Cookie" and "Host" are forbidden request-headers, which undici doesn't implement. + request.headersList.delete('cookie') + request.headersList.delete('host') } // 14. If request’s body is non-null, then set request’s body to the first return @@ -15283,7 +15301,7 @@ async function httpNetworkOrCacheFetch ( // user agents should append `User-Agent`/default `User-Agent` value to // httpRequest’s header list. if (!httpRequest.headersList.contains('user-agent')) { - httpRequest.headersList.append('user-agent', 'undici') + httpRequest.headersList.append('user-agent', typeof esbuildDetection === 'undefined' ? 'undici' : 'node') } // 15. If httpRequest’s cache mode is "default" and httpRequest’s header @@ -15345,6 +15363,8 @@ async function httpNetworkOrCacheFetch ( } } + httpRequest.headersList.delete('host') + // 20. If includeCredentials is true, then: if (includeCredentials) { // 1. If the user agent is not configured to block cookies for httpRequest diff --git a/package-lock.json b/package-lock.json index 9eea2f2a..fafdf486 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "zenn-metadata-updater-action", - "version": "2.1.3", + "version": "2.1.4", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "zenn-metadata-updater-action", - "version": "2.1.3", + "version": "2.1.4", "license": "MIT", "dependencies": { "@actions/core": "1.10.1", diff --git a/package.json b/package.json index f76e04d3..7dc941cb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "zenn-metadata-updater-action", - "version": "2.1.3", + "version": "2.1.4", "private": true, "description": "GitHub Action to update metadata in Zenn markdown file.", "main": "lib/main.js",