Skip to content

Commit d931ff0

Browse files
committed
Repackage action following semver 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 fa58d71 commit d931ff0

File tree

1 file changed

+24
-10
lines changed

1 file changed

+24
-10
lines changed

dist/index.js

+24-10
Original file line numberDiff line numberDiff line change
@@ -8109,6 +8109,8 @@ const Range = __nccwpck_require__(9828)
81098109
/***/ 9828:
81108110
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
81118111

8112+
const SPACE_CHARACTERS = /\s+/g
8113+
81128114
// hoisted class for cyclic dependency
81138115
class Range {
81148116
constructor (range, options) {
@@ -8129,7 +8131,7 @@ class Range {
81298131
// just put it in the set and return
81308132
this.raw = range.value
81318133
this.set = [[range]]
8132-
this.format()
8134+
this.formatted = undefined
81338135
return this
81348136
}
81358137

@@ -8140,10 +8142,7 @@ class Range {
81408142
// First reduce all whitespace as much as possible so we do not have to rely
81418143
// on potentially slow regexes like \s*. This is then stored and used for
81428144
// future error messages as well.
8143-
this.raw = range
8144-
.trim()
8145-
.split(/\s+/)
8146-
.join(' ')
8145+
this.raw = range.trim().replace(SPACE_CHARACTERS, ' ')
81478146

81488147
// First, split on ||
81498148
this.set = this.raw
@@ -8177,14 +8176,29 @@ class Range {
81778176
}
81788177
}
81798178

8180-
this.format()
8179+
this.formatted = undefined
8180+
}
8181+
8182+
get range () {
8183+
if (this.formatted === undefined) {
8184+
this.formatted = ''
8185+
for (let i = 0; i < this.set.length; i++) {
8186+
if (i > 0) {
8187+
this.formatted += '||'
8188+
}
8189+
const comps = this.set[i]
8190+
for (let k = 0; k < comps.length; k++) {
8191+
if (k > 0) {
8192+
this.formatted += ' '
8193+
}
8194+
this.formatted += comps[k].toString().trim()
8195+
}
8196+
}
8197+
}
8198+
return this.formatted
81818199
}
81828200

81838201
format () {
8184-
this.range = this.set
8185-
.map((comps) => comps.join(' ').trim())
8186-
.join('||')
8187-
.trim()
81888202
return this.range
81898203
}
81908204

0 commit comments

Comments
 (0)