Skip to content

Commit f59b9e7

Browse files
committed
Repackage action following undici bump
GitHub downloads each action run in a workflow during runtime and executes it as a complete package of code before you can use workflow commands like run to interact with the runner machine. This means that we must provide all JavaScript package dependencies as part of the distributed action in order for it to be usable in workflows. A naive approach to doing this is checking in the `node_modules` folder. However, this approach results in a huge amount of frequently changing external content being included in the repository, much of which is not even part of the executed program. A far better approach is to use the excellent ncc tool to compile the program, including all the relevant code from the dependencies, into a single file. We use a "continuous packaging" approach, where the packaged action code that is generated via ncc is always kept in sync with the development source code and dependencies. This allows a beta version of the action to be easily used in workflows by beta testers or those who need changes not in the release simply by using the name of the branch as the action ref (e.g., `uses: arduino/arduino-lint-action@main` will cause the version of the action from the tip of the `main` branch to be used by the workflow run). The update of the package dependency results in a change to the packaged code, so the packaging is here updated accordingly.
1 parent 899ff7e commit f59b9e7

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

dist/index.js

+17-1
Original file line numberDiff line numberDiff line change
@@ -18391,6 +18391,14 @@ const { isUint8Array, isArrayBuffer } = __nccwpck_require__(8253)
1839118391
const { File: UndiciFile } = __nccwpck_require__(3041)
1839218392
const { parseMIMEType, serializeAMimeType } = __nccwpck_require__(4322)
1839318393

18394+
let random
18395+
try {
18396+
const crypto = __nccwpck_require__(7598)
18397+
random = (max) => crypto.randomInt(0, max)
18398+
} catch {
18399+
random = (max) => Math.floor(Math.random(max))
18400+
}
18401+
1839418402
let ReadableStream = globalThis.ReadableStream
1839518403

1839618404
/** @type {globalThis['File']} */
@@ -18476,7 +18484,7 @@ function extractBody (object, keepalive = false) {
1847618484
// Set source to a copy of the bytes held by object.
1847718485
source = new Uint8Array(object.buffer.slice(object.byteOffset, object.byteOffset + object.byteLength))
1847818486
} else if (util.isFormDataLike(object)) {
18479-
const boundary = `----formdata-undici-0${`${Math.floor(Math.random() * 1e11)}`.padStart(11, '0')}`
18487+
const boundary = `----formdata-undici-0${`${random(1e11)}`.padStart(11, '0')}`
1848018488
const prefix = `--${boundary}\r\nContent-Disposition: form-data`
1848118489

1848218490
/*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */
@@ -32595,6 +32603,14 @@ module.exports = require("net");
3259532603

3259632604
/***/ }),
3259732605

32606+
/***/ 7598:
32607+
/***/ ((module) => {
32608+
32609+
"use strict";
32610+
module.exports = require("node:crypto");
32611+
32612+
/***/ }),
32613+
3259832614
/***/ 8474:
3259932615
/***/ ((module) => {
3260032616

0 commit comments

Comments
 (0)