mirror of
				https://kkgithub.com/actions/setup-node.git
				synced 2025-11-04 12:46:16 +08:00 
			
		
		
		
	fix: add warning for when arch is supplied but version is missing
This commit is contained in:
		
							
								
								
									
										5
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							@ -4645,6 +4645,11 @@ function run() {
 | 
				
			|||||||
                version = core.getInput('version');
 | 
					                version = core.getInput('version');
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            let arch = core.getInput('node-arch');
 | 
					            let arch = core.getInput('node-arch');
 | 
				
			||||||
 | 
					            // if node-arch supplied but node-version is not
 | 
				
			||||||
 | 
					            // if we don't throw a warning, the already installed x64 node will be used which is not probably what user meant.
 | 
				
			||||||
 | 
					            if (arch && !version) {
 | 
				
			||||||
 | 
					                core.warning('`node-arch` is provided but `node-version` is missing. This results in using an already installed x64 node which is not probably what you meant. To fix this, provide `node-arch` in combination with `node-version`');
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
            if (!arch) {
 | 
					            if (!arch) {
 | 
				
			||||||
                arch = os.arch();
 | 
					                arch = os.arch();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
				
			|||||||
@ -17,6 +17,15 @@ export async function run() {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let arch = core.getInput('node-arch');
 | 
					    let arch = core.getInput('node-arch');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // if node-arch supplied but node-version is not
 | 
				
			||||||
 | 
					    // if we don't throw a warning, the already installed x64 node will be used which is not probably what user meant.
 | 
				
			||||||
 | 
					    if (arch && !version) {
 | 
				
			||||||
 | 
					      core.warning(
 | 
				
			||||||
 | 
					        '`node-arch` is provided but `node-version` is missing. This results in using an already installed x64 node which is not probably what you meant. To fix this, provide `node-arch` in combination with `node-version`'
 | 
				
			||||||
 | 
					      );
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!arch) {
 | 
					    if (!arch) {
 | 
				
			||||||
      arch = os.arch();
 | 
					      arch = os.arch();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user