Skip to content

Commit cf76cba

Browse files
cdervgithub-actions[bot]
authored andcommitted
improve which page to preview
Open extension page more easily (cherry picked from commit bd4e5f2)
1 parent 2cce2af commit cf76cba

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

.github/workflows/preview.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,26 @@ jobs:
155155
if (changedFiles.length > 0) {
156156
commentBody += `### 🔄 Modified Documents\n\n`;
157157
changedFiles.forEach(file => {
158-
if (file.endsWith('.qmd') || file.endsWith('.md')) {
158+
let fileUrlPath;
159+
160+
// Define a mapping for special files to their corresponding URLs
161+
const specialFileMapping = {
162+
'docs/extensions/listings/shortcodes-and-filters.yml': 'docs/extensions/index.html',
163+
'docs/extensions/listings/journal-articles.yml': 'docs/extensions/index.html',
164+
'docs/extensions/listings/custom-formats.yml': 'docs/extensions/index.html',
165+
'docs/extensions/listings/revealjs-formats.yml': 'docs/extensions/index.html',
166+
'docs/extensions/listings/revealjs.yml': 'docs/extensions/index.html'
167+
};
168+
169+
// Check if the file is in the special mapping
170+
if (specialFileMapping[file]) {
171+
fileUrlPath = specialFileMapping[file];
172+
} else if (file.endsWith('.qmd') || file.endsWith('.md')) {
159173
// Convert path to URL (removing file extension and adding appropriate path)
160-
const fileUrlPath = file
161-
.replace(/\.(qmd|md)$/, '.html');
174+
fileUrlPath = file.replace(/\.(qmd|md)$/, '.html');
175+
}
176+
177+
if (fileUrlPath) {
162178
const fileUrl = `${deployUrl}/${fileUrlPath}`;
163179
commentBody += `- [${file}](${fileUrl})\n`;
164180
}

0 commit comments

Comments
 (0)