@@ -56,7 +56,11 @@ export function isCacheEnabled() {
5656}
5757
5858export function isUsingMoon ( ) {
59- return ! ! core . getInput ( 'moon-version' ) || fs . existsSync ( path . join ( getWorkspaceRoot ( ) , '.moon' ) ) ;
59+ return (
60+ ! ! core . getInput ( 'moon-version' ) ||
61+ fs . existsSync ( path . join ( getWorkspaceRoot ( ) , '.moon' ) ) ||
62+ fs . existsSync ( path . join ( getWorkspaceRoot ( ) , '.config' , 'moon' ) )
63+ ) ;
6064}
6165
6266export function shouldInstallMoon ( ) {
@@ -106,14 +110,22 @@ export async function getToolchainCacheKey() {
106110 if ( isUsingMoon ( ) ) {
107111 const root = core . getInput ( 'workspace-root' ) ;
108112
113+ files . push (
114+ // v1
115+ '.moon/toolchain.yml' ,
116+ // v2
117+ '.moon/toolchains.yml' ,
118+ '.config/moon/toolchains.yml' ,
119+ ) ;
120+
109121 if ( root ) {
110- files . push (
111- path . join ( root , '.prototools' ) ,
112- path . join ( root , '.protolock' ) ,
113- path . join ( root , '.moon/toolchain.yml' ) ,
114- ) ;
115- } else {
116- files . push ( '.moon/toolchain.yml' ) ;
122+ const moreFiles : string [ ] = [ ] ;
123+
124+ for ( const file of files ) {
125+ moreFiles . push ( path . join ( root , file ) ) ;
126+ }
127+
128+ files . push ( ... moreFiles ) ;
117129 }
118130 }
119131
@@ -156,17 +168,27 @@ export function getProtoVersion(): string {
156168 }
157169
158170 if ( isUsingMoon ( ) ) {
159- const toolchainPath = path . join ( getWorkspaceRoot ( ) , '.moon/toolchain.yml' ) ;
160-
161- if ( fs . existsSync ( toolchainPath ) ) {
162- const toolchain = yaml . parse ( fs . readFileSync ( toolchainPath , 'utf8' ) ) as {
163- proto ?: { version ?: string } ;
164- } ;
165- const protoVersion = toolchain . proto ?. version ;
166-
167- // Only fully-qualified is allowed
168- if ( protoVersion && typeof protoVersion === 'string' && protoVersion . split ( '.' ) . length >= 3 ) {
169- return protoVersion ;
171+ for ( const file of [
172+ '.moon/toolchain.yml' ,
173+ '.moon/toolchains.yml' ,
174+ '.config/moon/toolchains.yml' ,
175+ ] ) {
176+ const toolchainPath = path . join ( getWorkspaceRoot ( ) , file ) ;
177+
178+ if ( fs . existsSync ( toolchainPath ) ) {
179+ const toolchain = yaml . parse ( fs . readFileSync ( toolchainPath , 'utf8' ) ) as {
180+ proto ?: { version ?: string } ;
181+ } ;
182+ const protoVersion = toolchain ?. proto ?. version ;
183+
184+ // Only fully-qualified is allowed
185+ if (
186+ protoVersion &&
187+ typeof protoVersion === 'string' &&
188+ protoVersion . split ( '.' ) . length >= 3
189+ ) {
190+ return protoVersion ;
191+ }
170192 }
171193 }
172194 }
@@ -195,7 +217,10 @@ export async function installBin(bin: string) {
195217
196218 core . info ( 'Downloading installation script' ) ;
197219
198- const script = await tc . downloadTool ( `https://raw.githubusercontent.com/moonrepo/moon/refs/heads/master/website/static/install/${ scriptName } ` , scriptPath ) ;
220+ const script = await tc . downloadTool (
221+ `https://raw.githubusercontent.com/moonrepo/moon/refs/heads/master/website/static/install/${ scriptName } ` ,
222+ scriptPath ,
223+ ) ;
199224
200225 // eslint-disable-next-line no-magic-numbers
201226 await fs . promises . chmod ( script , 0o755 ) ;
0 commit comments