Skip to content

Commit 8f74483

Browse files
authored
fix cut offs (#346)
1 parent d135820 commit 8f74483

2 files changed

Lines changed: 39 additions & 4 deletions

File tree

.github/workflows/blog-post-pr.yml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,30 @@ jobs:
6262
script: |
6363
const body = context.payload.issue.body ?? '';
6464
65+
// Known issue-form field headings (used to detect section boundaries)
66+
const knownFields = [
67+
'Post title',
68+
'Slug \\(URL-friendly identifier\\)',
69+
'Publication date',
70+
'Categories',
71+
'Short description',
72+
'Post body',
73+
'Links \\(optional\\)',
74+
'Author ID',
75+
'Your full name',
76+
'Job title \\/ bio',
77+
'Avatar URL',
78+
'Profile URL'
79+
];
80+
6581
// Helper: extract the text under a given issue-form heading
6682
function extract(label) {
67-
// Matches "### Label\n\nvalue" blocks produced by GitHub issue forms
83+
// Build a lookahead that only stops at other known field headings, not arbitrary ### headings in content
84+
const otherFields = knownFields
85+
.filter(f => f.toLowerCase() !== label.toLowerCase())
86+
.join('|');
6887
const re = new RegExp(
69-
`### ${label}\\s*\\n+([\\s\\S]*?)(?=\\n### |$)`,
88+
`### ${label}\\s*\\n+([\\s\\S]*?)(?=\\n### (?:${otherFields})\\s*\\n|$)`,
7089
'i'
7190
);
7291
const m = body.match(re);

.github/workflows/project-submission-pr.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,27 @@ jobs:
6464
script: |
6565
const body = context.payload.issue.body ?? '';
6666
67+
// Known issue-form field headings (used to detect section boundaries)
68+
const knownFields = [
69+
'Project Title',
70+
'One-Line Summary',
71+
'Origin \\(Optional\\)',
72+
'Project Tags',
73+
'Project Description',
74+
'Relevant Links \\(Optional\\)',
75+
'Project Status',
76+
'Year \\(if Past Project\\)',
77+
'Main Work Area Category'
78+
];
79+
6780
// Helper: extract the text under a given issue-form heading
6881
function extract(label) {
69-
// Matches "### Label\n\nvalue" blocks produced by GitHub issue forms
82+
// Build a lookahead that only stops at other known field headings, not arbitrary ### headings in content
83+
const otherFields = knownFields
84+
.filter(f => f.toLowerCase() !== label.toLowerCase())
85+
.join('|');
7086
const re = new RegExp(
71-
`### ${label}\\s*\\n+([\\s\\S]*?)(?=\\n### |$)`,
87+
`### ${label}\\s*\\n+([\\s\\S]*?)(?=\\n### (?:${otherFields})\\s*\\n|$)`,
7288
'i'
7389
);
7490
const m = body.match(re);

0 commit comments

Comments
 (0)