Skip to content

Commit 3764cfd

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 f39f1c7 commit 3764cfd

File tree

1 file changed

+24
-10
lines changed

1 file changed

+24
-10
lines changed

dist/index.js

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8666,6 +8666,8 @@ const Range = __nccwpck_require__(9828)
86668666
/***/ 9828:
86678667
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
86688668

8669+
const SPACE_CHARACTERS = /\s+/g
8670+
86698671
// hoisted class for cyclic dependency
86708672
class Range {
86718673
constructor (range, options) {
@@ -8686,7 +8688,7 @@ class Range {
86868688
// just put it in the set and return
86878689
this.raw = range.value
86888690
this.set = [[range]]
8689-
this.format()
8691+
this.formatted = undefined
86908692
return this
86918693
}
86928694

@@ -8697,10 +8699,7 @@ class Range {
86978699
// First reduce all whitespace as much as possible so we do not have to rely
86988700
// on potentially slow regexes like \s*. This is then stored and used for
86998701
// future error messages as well.
8700-
this.raw = range
8701-
.trim()
8702-
.split(/\s+/)
8703-
.join(' ')
8702+
this.raw = range.trim().replace(SPACE_CHARACTERS, ' ')
87048703

87058704
// First, split on ||
87068705
this.set = this.raw
@@ -8734,14 +8733,29 @@ class Range {
87348733
}
87358734
}
87368735

8737-
this.format()
8736+
this.formatted = undefined
8737+
}
8738+
8739+
get range () {
8740+
if (this.formatted === undefined) {
8741+
this.formatted = ''
8742+
for (let i = 0; i < this.set.length; i++) {
8743+
if (i > 0) {
8744+
this.formatted += '||'
8745+
}
8746+
const comps = this.set[i]
8747+
for (let k = 0; k < comps.length; k++) {
8748+
if (k > 0) {
8749+
this.formatted += ' '
8750+
}
8751+
this.formatted += comps[k].toString().trim()
8752+
}
8753+
}
8754+
}
8755+
return this.formatted
87388756
}
87398757

87408758
format () {
8741-
this.range = this.set
8742-
.map((comps) => comps.join(' ').trim())
8743-
.join('||')
8744-
.trim()
87458759
return this.range
87468760
}
87478761

0 commit comments

Comments
 (0)