Skip to content

Commit aa774d7

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 236e146 commit aa774d7

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

dist/index.js

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7961,6 +7961,7 @@ const isSatisfiable = (comparators, options) => {
79617961
// already replaced the hyphen ranges
79627962
// turn into a set of JUST comparators.
79637963
const parseComparator = (comp, options) => {
7964+
comp = comp.replace(re[t.BUILD], '')
79647965
debug('comp', comp, options)
79657966
comp = replaceCarets(comp, options)
79667967
debug('caret', comp)
@@ -8381,11 +8382,25 @@ class SemVer {
83818382
other = new SemVer(other, this.options)
83828383
}
83838384

8384-
return (
8385-
compareIdentifiers(this.major, other.major) ||
8386-
compareIdentifiers(this.minor, other.minor) ||
8387-
compareIdentifiers(this.patch, other.patch)
8388-
)
8385+
if (this.major < other.major) {
8386+
return -1
8387+
}
8388+
if (this.major > other.major) {
8389+
return 1
8390+
}
8391+
if (this.minor < other.minor) {
8392+
return -1
8393+
}
8394+
if (this.minor > other.minor) {
8395+
return 1
8396+
}
8397+
if (this.patch < other.patch) {
8398+
return -1
8399+
}
8400+
if (this.patch > other.patch) {
8401+
return 1
8402+
}
8403+
return 0
83898404
}
83908405

83918406
comparePre (other) {
@@ -9286,6 +9301,10 @@ module.exports = debug
92869301

92879302
const numeric = /^[0-9]+$/
92889303
const compareIdentifiers = (a, b) => {
9304+
if (typeof a === 'number' && typeof b === 'number') {
9305+
return a === b ? 0 : a < b ? -1 : 1
9306+
}
9307+
92899308
const anum = numeric.test(a)
92909309
const bnum = numeric.test(b)
92919310

0 commit comments

Comments
 (0)