Skip to content

Commit 3b4f363

Browse files
committed
fix(ci): correct tutorial preview URL generation in sync-untranslated-issue script
1 parent e93b833 commit 3b4f363

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

.github/scripts/sync-untranslated-issue.mjs

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,23 @@ function generateLinks(filepath) {
7878
const issueUrl = `https://github.com/angular/angular-ja/issues/new?template=translation-checkout.md&title=${encodeURIComponent('translate: ' + title)}`;
7979

8080
// .mdファイルのみプレビューURL生成
81-
let previewUrl = null;
82-
if (filepath.endsWith('.md')) {
83-
const previewPath = filepath
84-
.replace('src/content/', '')
85-
.replace(/\/README\.md$/, '') // READMEの場合はディレクトリのみ
86-
.replace(/\.md$/, '');
87-
previewUrl = `https://angular.jp/${previewPath}`;
88-
}
81+
const previewUrl = filepath.endsWith('.md')
82+
? (() => {
83+
const basePath = filepath
84+
.replace('src/content/', '')
85+
.replace(/\/README\.md$/, '') // READMEの場合はディレクトリのみ
86+
.replace(/\.md$/, '');
87+
88+
// チュートリアルの特殊なパス変換
89+
const previewPath = basePath.startsWith('tutorials/')
90+
? basePath
91+
.replace(/\/intro$/, '') // intro ディレクトリを削除
92+
.replace(/\/steps\//, '/') // steps/ を削除
93+
: basePath;
94+
95+
return `https://angular.jp/${previewPath}`;
96+
})()
97+
: null;
8998

9099
return { githubUrl, previewUrl, issueUrl };
91100
}

0 commit comments

Comments
 (0)