Skip to content

Commit d6e8452

Browse files
committed
n8n automation
1 parent ba53af8 commit d6e8452

1 file changed

Lines changed: 30 additions & 1 deletion

File tree

VERSION

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,30 @@
1-
1.0.0
1+
const fileData = items[0].json;
2+
3+
const base64 = fileData.content.content; // base64 encoded version string
4+
const currentVersion = Buffer.from(base64, 'base64').toString('utf-8').trim();
5+
6+
// Parse version
7+
let [major, minor] = currentVersion.split('.').map(Number);
8+
9+
// Bump logic: 1.0 → 1.1 … 1.9 → 1.10 → 2.0
10+
if (minor < 10) {
11+
minor += 1;
12+
} else {
13+
major += 1;
14+
minor = 0;
15+
}
16+
17+
const newVersion = `${major}.${minor}`;
18+
const encoded = Buffer.from(newVersion).toString('base64');
19+
20+
// Output payload for GitHub Update File node
21+
return [
22+
{
23+
json: {
24+
path: fileData.content.path,
25+
content: encoded,
26+
message: `Bump version to ${newVersion}`,
27+
sha: fileData.content.sha,
28+
},
29+
},
30+
];

0 commit comments

Comments
 (0)