const execa = require('execa'); const fs = require('fs/promises'); const path = require('path'); const { Command } = require('commander'); const program = new Command(); const axios = require('axios'); program .option('-f, --from [from]') .option('-t, --to [to]') .option('-v, --ver [ver]', '', 'beta') .option('--test') .option('--cmsURL [url]') .option('--cmsToken [token]'); program.parse(process.argv); const header = { en: `# Changelog All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). `, cn: `# 更新日志 本项目的所有重要更改都将记录在此文件中。 格式基于 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.0.0/), 并且本项目遵循 [语义化版本](https://semver.org/spec/v2.0.0.html)。 `, }; function parsePRBody(body, language) { const regExp = new RegExp(`${language}[ ]?\\|[ ]?([^\\|]*)\\|`, 'g'); const match = [...body.matchAll(regExp)]; if (!match.length) { return { description: '', docTitle: '', docLink: '', }; } const description = match[0]?.[1].trim() || ''; const docLink = match[1]?.[1].trim(); if (!docLink || docLink.startsWith('