Actions35
- Cleaning Actions
- Coercion Actions
- Comparison Actions
- Increment Actions
- Parsing Actions
- Range Actions
- Sorting Actions
- Validation Actions
Overview
This node provides utilities for working with semantic versioning (semver) strings. Specifically, the "Comparison" resource with the "Diff" operation calculates the difference between two version strings, indicating what kind of version change occurred (e.g., major, minor, patch).
Use cases include:
- Determining the type of update between software versions.
- Automating release notes by identifying version differences.
- Conditional workflows based on version changes.
For example, comparing version "1.2.3" to "1.3.0" would return "minor", indicating a minor version increment.
Properties
| Name | Meaning |
|---|---|
| Version 1 | The first version string to compare (e.g., "1.2.3"). |
| Version 2 | The second version string to compare (e.g., "1.2.4"). |
| Options | Collection of options: • Loose: Use loose parsing for version strings (true/false). • Include Prerelease: Include prerelease versions in range matching (true/false). • RTL (Right to Left): Whether to coerce version strings right to left (only relevant for coercion resource). |
Output
The output JSON contains the following structure:
{
"operation": "diff",
"version1": "1.2.3",
"version2": "1.2.4",
"result": "patch"
}
operation: The performed operation, here always"diff".version1: The first input version string.version2: The second input version string.result: A string describing the difference between the two versions. Possible values are typical semver difference types such as"major","minor","patch","premajor","preminor","prepatch","prerelease", ornullif no difference is found.
No binary data output is produced by this operation.
Dependencies
- This node depends on the external
semverlibrary for all version parsing and comparison logic. - No external API keys or services are required.
- No special environment variables or n8n credentials are needed.
Troubleshooting
- Invalid version strings: If either version string is not a valid semver format, the result may be
nullor an error might occur. Ensure inputs conform to semantic versioning standards. - Loose parsing option: Enabling "Loose" parsing can help handle non-standard version strings but may produce unexpected results.
- Empty inputs: Providing empty or missing version strings will likely cause errors or invalid results.
- Error messages: Errors thrown typically indicate invalid input versions or unknown resources/operations. Verify that the Resource is set to "Comparison" and Operation to "Diff".
Links and References
- Semantic Versioning Specification
- semver npm package - The underlying library used for version operations