@@ -4,23 +4,25 @@ import { $ } from "npm:zx";
44import process from "node:process" ;
55import { temporaryDirectory , temporaryWrite } from "npm:tempy" ;
66import { join } from "node:path" ;
7- import * as core from "npm:@actions/core"
8- import { glob } from "npm:glob"
7+ import * as core from "npm:@actions/core" ;
8+ import { glob } from "npm:glob" ;
99
10- let path = core . getInput ( "path" )
10+ let path = core . getInput ( "path" ) ;
1111if ( ( await lstat ( path ) ) . isDirectory ( ) ) {
12- console . log ( "original path" )
13- const pattern = join ( path , "[Rr][Ee][Aa][Dd][Mm][Ee].{md,mdown,markdown}" )
14- console . log ( "glob pattern" , pattern )
15- [ path ] = await glob ( pattern )
12+ console . log ( "original path" ) ;
13+ const pattern = join ( path , "[Rr][Ee][Aa][Dd][Mm][Ee].{md,mdown,markdown}" ) ;
14+ console . log ( "glob pattern" , pattern ) ;
15+ const globbed = await glob ( pattern ) ;
16+ console . log ( "glob result" , globbed ) ;
17+ path = globbed [ 0 ] ;
1618}
17- console . log ( "resolved path" , path )
19+ console . log ( "resolved path" , path ) ;
1820
19- let collection = core . getInput ( "collection" )
21+ let collection = core . getInput ( "collection" ) ;
2022if ( ! collection . includes ( ":" ) ) {
21- collection += ":latest"
23+ collection += ":latest" ;
2224}
23- console . log ( "resolved collection" , collection )
25+ console . log ( "resolved collection" , collection ) ;
2426
2527let md = await readFile ( path , "utf8" ) ;
2628
@@ -31,14 +33,14 @@ await $`oras pull ${collection}`;
3133const devcontainerCollection = JSON . parse (
3234 await readFile ( join ( $ . cwd , "devcontainer-collection.json" ) , "utf8" )
3335) ;
34- console . log ( devcontainerCollection )
36+ console . log ( devcontainerCollection ) ;
3537
3638if ( devcontainerCollection . features ) {
3739 const featureListMD = devcontainerCollection . features
3840 . filter ( ( f ) => f . documentationURL )
3941 . map ( ( f ) => `- **[${ f . name } ](${ f . documentationURL } )** - ${ f . description } ` )
4042 . join ( "\n" ) ;
41- console . log ( featureListMD )
43+ console . log ( featureListMD ) ;
4244
4345 md = md . replace (
4446 / ( < ! - - S T A R T _ F E A T U R E _ L I S T - - > ) ( [ \s \S ] * ?) ( < ! - - E N D _ F E A T U R E _ L I S T - - > ) / ,
@@ -51,7 +53,7 @@ if (devcontainerCollection.templates) {
5153 . filter ( ( f ) => f . documentationURL )
5254 . map ( ( f ) => `- **[${ f . name } ](${ f . documentationURL } )** - ${ f . description } ` )
5355 . join ( "\n" ) ;
54- console . log ( templateListMD )
56+ console . log ( templateListMD ) ;
5557
5658 md = md . replace (
5759 / ( < ! - - S T A R T _ T E M P L A T E _ L I S T - - > ) ( [ \s \S ] * ?) ( < ! - - E N D _ T E M P L A T E _ L I S T - - > ) / ,
0 commit comments