Skip to content

Commit 4348d1c

Browse files
committed
fix(config): use safeParseJSON for bump_targets
- Updated config to safely parse JSON input for bump_targets. - Improved error handling for invalid JSON in bump_targets.
1 parent 84ae999 commit 4348d1c

5 files changed

Lines changed: 13 additions & 9 deletions

File tree

dist/index.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/**
2-
* universal-version-bump v0.12.1
2+
* universal-version-bump v0.12.2
33
* Universal Version Bump
44
*
55
* Description: A GitHub Action to automatically bump versions across any app (Node, Python, PHP, Docker, etc.)
66
* Author: Taj <[email protected]>
77
* Homepage: https://github.com/taj54/universal-version-bump#readme
88
* License: MIT
9-
* Generated on Sat, 30 Aug 2025 13:50:05 GMT
9+
* Generated on Sat, 30 Aug 2025 14:20:54 GMT
1010
*/
1111
require('./sourcemap-register.js');/******/ (() => { // webpackBootstrap
1212
/******/ var __webpack_modules__ = ({
@@ -32669,11 +32669,12 @@ var __importStar = (this && this.__importStar) || (function () {
3266932669
Object.defineProperty(exports, "__esModule", ({ value: true }));
3267032670
exports.BUMP_TARGETS = exports.TARGET_PATH = exports.GIT_TAG = exports.TARGET_PLATFORM = exports.RELEASE_TYPE = void 0;
3267132671
const core = __importStar(__nccwpck_require__(9999));
32672+
const utils_1 = __nccwpck_require__(9499);
3267232673
exports.RELEASE_TYPE = (core.getInput('release_type') || 'patch');
3267332674
exports.TARGET_PLATFORM = core.getInput('target_platform');
3267432675
exports.GIT_TAG = core.getInput('git_tag') === 'true';
3267532676
exports.TARGET_PATH = core.getInput('target_path') || '.';
32676-
exports.BUMP_TARGETS = core.getInput('bump_targets') || '[]';
32677+
exports.BUMP_TARGETS = (0, utils_1.safeParseJSON)(core.getInput('bump_targets'));
3267732678

3267832679

3267932680
/***/ }),
@@ -32800,10 +32801,10 @@ async function run() {
3280032801
process.chdir(config_1.TARGET_PATH);
3280132802
const releaseType = config_1.RELEASE_TYPE;
3280232803
const targetPlatform = config_1.TARGET_PLATFORM;
32804+
const bumpTargets = config_1.BUMP_TARGETS;
3280332805
const { updaterService, gitService, changelogService } = await initializeServices();
3280432806
const platform = updaterService.getPlatform(targetPlatform);
3280532807
core.info(`Detected platform: ${platform}`);
32806-
const bumpTargets = (0, utils_1.safeParseJSON)(config_1.BUMP_TARGETS);
3280732808
core.info(`Bump targets: ${JSON.stringify(bumpTargets)}`);
3280832809
const version = updaterService.updateVersion(platform, releaseType, bumpTargets);
3280932810
core.setOutput('new_version', version);

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "universal-version-bump",
33
"displayName": "Universal Version Bump",
4-
"version": "0.12.1",
4+
"version": "0.12.2",
55
"description": "A GitHub Action to automatically bump versions across any app (Node, Python, PHP, Docker, etc.)",
66
"main": "dist/index.js",
77
"scripts": {

src/config/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import * as core from '@actions/core';
22
import semver from 'semver';
3+
import { safeParseJSON } from '../utils';
34

45
export const RELEASE_TYPE = (core.getInput('release_type') || 'patch') as semver.ReleaseType;
56
export const TARGET_PLATFORM = core.getInput('target_platform');
67
export const GIT_TAG = core.getInput('git_tag') === 'true';
78
export const TARGET_PATH = core.getInput('target_path') || '.';
8-
export const BUMP_TARGETS = core.getInput('bump_targets') || '[]';
9+
export const BUMP_TARGETS = safeParseJSON<{ path: string; variable: string }[]>(
10+
core.getInput('bump_targets'),
11+
);

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { UpdaterService, GitService, ChangelogService } from './services';
2-
import { FileHandler, safeParseJSON } from './utils';
2+
import { FileHandler } from './utils';
33
import { UpdaterRegistry } from './registry';
44
import {
55
PlatformDetectionError,
@@ -32,13 +32,13 @@ export async function run() {
3232
process.chdir(TARGET_PATH);
3333
const releaseType = RELEASE_TYPE;
3434
const targetPlatform = TARGET_PLATFORM;
35+
const bumpTargets = BUMP_TARGETS;
3536

3637
const { updaterService, gitService, changelogService } = await initializeServices();
3738

3839
const platform = updaterService.getPlatform(targetPlatform);
3940
core.info(`Detected platform: ${platform}`);
4041

41-
const bumpTargets = safeParseJSON<{ path: string; variable: string }[]>(BUMP_TARGETS);
4242
core.info(`Bump targets: ${JSON.stringify(bumpTargets)}`);
4343
const version = updaterService.updateVersion(platform, releaseType, bumpTargets);
4444
core.setOutput('new_version', version);

0 commit comments

Comments
 (0)