Skip to content

Commit

Permalink
Update index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
taoliujun authored Mar 5, 2024
1 parent 8fcf42c commit 8a7dcf0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .github/actions/issue-to-hexo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ const generateIssue = async (issue_number) => {

const { title, body, created_at, labels, html_url } = issue.data;

const bodyMatch = body.match(/<!--hexo\r?\n---([\r\n\s\S]+)---\r?\n-->/);
const bodyMatch = body.match(/<!--hexo(\r?\n)+?---([\r\n\s\S]+)---(\r?\n)+?-->/);
if (!bodyMatch) {
throw new Error(`#${issue_number} has no hexo data`);
}

const urlMatch = bodyMatch[1].match(/url: ([\s\S]+?)\r?\n/);
const urlMatch = bodyMatch[2].match(/url: ([\s\S]+?)\r?\n/);
if (!urlMatch) {
throw new Error(`#${issue_number} has no url`);
}
Expand All @@ -33,7 +33,7 @@ const generateIssue = async (issue_number) => {
})
?.join(`\n`);

const hexoData = `---\ntitle: "${title}"\ndate: "${created_at}"\ncategories:\n${categories}\n${bodyMatch[1]}\n---\n`;
const hexoData = `---\ntitle: "${title}"\ndate: "${created_at}"\ncategories:\n${categories}\n${bodyMatch[2]}\n---\n`;

const path = urlMatch[1];

Expand Down

0 comments on commit 8a7dcf0

Please sign in to comment.