mirror of
https://github.com/taskgenius/taskgenius-plugin.git
synced 2026-07-22 06:40:25 +00:00
fix(release): avoid modifying immutable commit objects in changelog transform
- Create a copy of commit object before modifying - Prevent 'Cannot modify immutable object' error - Safely add shortHash property to transformed commits
This commit is contained in:
parent
7d2a9f42c5
commit
8f7b163aff
1 changed files with 7 additions and 4 deletions
|
|
@ -122,13 +122,16 @@ module.exports = {
|
|||
}
|
||||
}
|
||||
|
||||
// 创建一个新的 commit 对象副本,避免修改原始对象
|
||||
const transformedCommit = Object.assign({}, commit);
|
||||
|
||||
// 确保 commit 有短 hash 用于显示
|
||||
if (commit.hash) {
|
||||
commit.shortHash = commit.hash.substring(0, 7);
|
||||
if (transformedCommit.hash && !transformedCommit.shortHash) {
|
||||
transformedCommit.shortHash = transformedCommit.hash.substring(0, 7);
|
||||
}
|
||||
|
||||
// 保留其他所有提交
|
||||
return commit;
|
||||
// 返回转换后的提交
|
||||
return transformedCommit;
|
||||
},
|
||||
// 确保比较链接使用正确的版本范围
|
||||
finalizeContext: (context) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue