@@ -50,6 +50,8 @@ if (doWrite) {
5050 } ) . trim ( ) ;
5151}
5252
53+ let hasNewRevision = false ;
54+
5355const langEntries = await getPagesList ( ) ;
5456
5557const revisionsPrevYml = existsSync ( join ( docsDir , "revisions.yml" ) )
@@ -70,6 +72,7 @@ for (const lang of langEntries) {
7072 // ドキュメントが変更された場合
7173 console . warn ( `${ section . id } has new md5: ${ section . md5 } ` ) ;
7274 if ( doWrite ) {
75+ hasNewRevision = true ;
7376 revisions [ section . id ] . rev . push ( {
7477 md5 : section . md5 ,
7578 git : commit ,
@@ -83,6 +86,7 @@ for (const lang of langEntries) {
8386 // ドキュメントが新規追加された場合
8487 console . warn ( `${ section . id } is new section` ) ;
8588 if ( doWrite ) {
89+ hasNewRevision = true ;
8690 revisions [ section . id ] = {
8791 rev : [
8892 {
@@ -142,4 +146,23 @@ if (doWrite) {
142146 revisionsYml ,
143147 "utf-8"
144148 ) ;
149+
150+ if ( hasNewRevision ) {
151+ const commitsYml = yaml . load (
152+ await readFile ( join ( docsDir , "commits.yml" ) , "utf-8" )
153+ ) as Record < string , string > ;
154+ commitsYml [ commit ] = execFileSync (
155+ "git" ,
156+ [ "show" , "-s" , "--format=%cI" , commit ] ,
157+ {
158+ encoding : "utf8" ,
159+ }
160+ ) . trim ( ) ;
161+ await writeFile (
162+ join ( docsDir , "commits.yml" ) ,
163+ "# This file will be updated by CI. Do not edit manually.\n" +
164+ yaml . dump ( commitsYml , { sortKeys : true } ) ,
165+ "utf-8"
166+ ) ;
167+ }
145168}
0 commit comments