1
0
mirror of https://github.com/joaquinjsb/gitea-release-please-action synced 2026-05-13 18:51:34 +02:00

fix: path was sometimes empty string

This commit is contained in:
bcoe
2020-08-02 15:55:26 -07:00
parent 9f0933c4aa
commit 37d774119e
3 changed files with 138 additions and 106 deletions

View File

@@ -20,7 +20,7 @@ Automate releases with Conventional Commit Messages.
release-please: release-please:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: GoogleCloudPlatform/release-please-action@v1.6.2 - uses: GoogleCloudPlatform/release-please-action@v1.6.3
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
release-type: node release-type: node
@@ -105,7 +105,7 @@ jobs:
release-please: release-please:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: GoogleCloudPlatform/release-please-action@v1.6.2 - uses: GoogleCloudPlatform/release-please-action@v1.6.3
id: release id: release
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}

182
dist/index.js vendored
View File

@@ -1732,7 +1732,7 @@ async function main () {
const bumpMinorPreMajor = Boolean(core.getInput('bump-minor-pre-major')) const bumpMinorPreMajor = Boolean(core.getInput('bump-minor-pre-major'))
const monorepoTags = Boolean(core.getInput('monorepo-tags')) const monorepoTags = Boolean(core.getInput('monorepo-tags'))
const packageName = core.getInput('package-name') const packageName = core.getInput('package-name')
const path = core.getInput('path') const path = core.getInput('path') ? core.getInput('path') : undefined
const releaseType = core.getInput('release-type') const releaseType = core.getInput('release-type')
const token = core.getInput('token') const token = core.getInput('token')
@@ -1742,7 +1742,7 @@ async function main () {
label: RELEASE_LABEL, label: RELEASE_LABEL,
repoUrl: process.env.GITHUB_REPOSITORY, repoUrl: process.env.GITHUB_REPOSITORY,
packageName, packageName,
path: path ? path : undefined, path,
token token
}) })
const releaseCreated = await gr.createRelease() const releaseCreated = await gr.createRelease()
@@ -3138,117 +3138,148 @@ SafeBuffer.allocUnsafeSlow = function (size) {
"use strict"; "use strict";
var isObj = __webpack_require__(804); const isObj = __webpack_require__(804);
module.exports.get = function (obj, path) { const disallowedKeys = [
if (!isObj(obj) || typeof path !== 'string') { '__proto__',
return obj; 'prototype',
'constructor'
];
const isValidPath = pathSegments => !pathSegments.some(segment => disallowedKeys.includes(segment));
function getPathSegments(path) {
const pathArray = path.split('.');
const parts = [];
for (let i = 0; i < pathArray.length; i++) {
let p = pathArray[i];
while (p[p.length - 1] === '\\' && pathArray[i + 1] !== undefined) {
p = p.slice(0, -1) + '.';
p += pathArray[++i];
} }
var pathArr = getPathSegments(path); parts.push(p);
}
for (var i = 0; i < pathArr.length; i++) { if (!isValidPath(parts)) {
var descriptor = Object.getOwnPropertyDescriptor(obj, pathArr[i]) || Object.getOwnPropertyDescriptor(Object.prototype, pathArr[i]); return [];
if (descriptor && !descriptor.enumerable) { }
return parts;
}
module.exports = {
get(object, path, value) {
if (!isObj(object) || typeof path !== 'string') {
return value === undefined ? object : value;
}
const pathArray = getPathSegments(path);
if (pathArray.length === 0) {
return; return;
} }
obj = obj[pathArr[i]]; for (let i = 0; i < pathArray.length; i++) {
if (!Object.prototype.propertyIsEnumerable.call(object, pathArray[i])) {
return value;
}
if (obj === undefined || obj === null) { object = object[pathArray[i]];
// `obj` is either `undefined` or `null` so we want to stop the loop, and
if (object === undefined || object === null) {
// `object` is either `undefined` or `null` so we want to stop the loop, and
// if this is not the last bit of the path, and // if this is not the last bit of the path, and
// if it did't return `undefined` // if it did't return `undefined`
// it would return `null` if `obj` is `null` // it would return `null` if `object` is `null`
// but we want `get({foo: null}, 'foo.bar')` to equal `undefined` not `null` // but we want `get({foo: null}, 'foo.bar')` to equal `undefined`, or the supplied value, not `null`
if (i !== pathArr.length - 1) { if (i !== pathArray.length - 1) {
return undefined; return value;
} }
break; break;
} }
} }
return obj; return object;
}; },
module.exports.set = function (obj, path, value) { set(object, path, value) {
if (!isObj(obj) || typeof path !== 'string') { if (!isObj(object) || typeof path !== 'string') {
return object;
}
const root = object;
const pathArray = getPathSegments(path);
for (let i = 0; i < pathArray.length; i++) {
const p = pathArray[i];
if (!isObj(object[p])) {
object[p] = {};
}
if (i === pathArray.length - 1) {
object[p] = value;
}
object = object[p];
}
return root;
},
delete(object, path) {
if (!isObj(object) || typeof path !== 'string') {
return; return;
} }
var pathArr = getPathSegments(path); const pathArray = getPathSegments(path);
for (var i = 0; i < pathArr.length; i++) { for (let i = 0; i < pathArray.length; i++) {
var p = pathArr[i]; const p = pathArray[i];
if (!isObj(obj[p])) { if (i === pathArray.length - 1) {
obj[p] = {}; delete object[p];
}
if (i === pathArr.length - 1) {
obj[p] = value;
}
obj = obj[p];
}
};
module.exports.delete = function (obj, path) {
if (!isObj(obj) || typeof path !== 'string') {
return; return;
} }
var pathArr = getPathSegments(path); object = object[p];
for (var i = 0; i < pathArr.length; i++) { if (!isObj(object)) {
var p = pathArr[i];
if (i === pathArr.length - 1) {
delete obj[p];
return; return;
} }
obj = obj[p];
} }
}; },
module.exports.has = function (obj, path) { has(object, path) {
if (!isObj(obj) || typeof path !== 'string') { if (!isObj(object) || typeof path !== 'string') {
return false; return false;
} }
var pathArr = getPathSegments(path); const pathArray = getPathSegments(path);
if (pathArray.length === 0) {
return false;
}
for (var i = 0; i < pathArr.length; i++) { // eslint-disable-next-line unicorn/no-for-loop
obj = obj[pathArr[i]]; for (let i = 0; i < pathArray.length; i++) {
if (isObj(object)) {
if (!(pathArray[i] in object)) {
return false;
}
if (obj === undefined) { object = object[pathArray[i]];
} else {
return false; return false;
} }
} }
return true; return true;
}
}; };
function getPathSegments(path) {
var pathArr = path.split('.');
var parts = [];
for (var i = 0; i < pathArr.length; i++) {
var p = pathArr[i];
while (p[p.length - 1] === '\\' && pathArr[i + 1] !== undefined) {
p = p.slice(0, -1) + '.';
p += pathArr[++i];
}
parts.push(p);
}
return parts;
}
/***/ }), /***/ }),
/* 153 */, /* 153 */,
@@ -3644,7 +3675,7 @@ const parserOpts = __webpack_require__(239)
const writerOpts = __webpack_require__(579) const writerOpts = __webpack_require__(579)
module.exports = function (config) { module.exports = function (config) {
return Q.all([parserOpts, writerOpts]) return Q.all([parserOpts(config), writerOpts(config)])
.spread((parserOpts, writerOpts) => { .spread((parserOpts, writerOpts) => {
return { parserOpts, writerOpts } return { parserOpts, writerOpts }
}) })
@@ -42998,9 +43029,10 @@ module.exports = minor
"use strict"; "use strict";
module.exports = function (x) {
var type = typeof x; module.exports = value => {
return x !== null && (type === 'object' || type === 'function'); const type = typeof value;
return value !== null && (type === 'object' || type === 'function');
}; };

View File

@@ -8,7 +8,7 @@ async function main () {
const bumpMinorPreMajor = Boolean(core.getInput('bump-minor-pre-major')) const bumpMinorPreMajor = Boolean(core.getInput('bump-minor-pre-major'))
const monorepoTags = Boolean(core.getInput('monorepo-tags')) const monorepoTags = Boolean(core.getInput('monorepo-tags'))
const packageName = core.getInput('package-name') const packageName = core.getInput('package-name')
const path = core.getInput('path') const path = core.getInput('path') ? core.getInput('path') : undefined
const releaseType = core.getInput('release-type') const releaseType = core.getInput('release-type')
const token = core.getInput('token') const token = core.getInput('token')
@@ -18,7 +18,7 @@ async function main () {
label: RELEASE_LABEL, label: RELEASE_LABEL,
repoUrl: process.env.GITHUB_REPOSITORY, repoUrl: process.env.GITHUB_REPOSITORY,
packageName, packageName,
path: path ? path : undefined, path,
token token
}) })
const releaseCreated = await gr.createRelease() const releaseCreated = await gr.createRelease()