11import fs from 'fs/promises' ;
22import pathlib from 'path' ;
33import * as core from '@actions/core' ;
4- import { exec , getExecOutput } from '@actions/exec' ;
4+ import { getExecOutput } from '@actions/exec' ;
55
66interface PackageRecord {
77 directory : string
@@ -17,7 +17,7 @@ interface PackageRecord {
1717async function checkForChanges ( directory : string ) {
1818 const { exitCode } = await getExecOutput (
1919 'git' ,
20- [ '--no-pager' , 'diff' , '--quiet' , 'master' , '--' , directory ] ,
20+ [ '--no-pager' , 'diff' , '--quiet' , 'origin/ master' , '--' , directory ] ,
2121 { failOnStdErr : false }
2222 ) ;
2323 return exitCode !== 0 ;
@@ -36,17 +36,16 @@ async function findPackages(directory: string, maxDepth?: number) {
3636 const fullPath = pathlib . join ( currentDir , item . name ) ;
3737 if ( item . isFile ( ) ) {
3838 if ( item . name === 'package.json' ) {
39+ core . info ( `Found ${ fullPath } ` ) ;
3940 try {
4041 const { default : { name } } = await import ( fullPath , { with : { type : 'json' } } ) ;
41- if ( name ) {
42- const changes = await checkForChanges ( currentDir ) ;
43- yield {
44- directory : currentDir ,
45- changes,
46- name
47- } ;
48- return ;
42+ const changes = await checkForChanges ( currentDir ) ;
43+ yield {
44+ directory : currentDir ,
45+ changes,
46+ name
4947 } ;
48+ return ;
5049 } catch { }
5150 }
5251 continue ;
@@ -66,10 +65,8 @@ async function findPackages(directory: string, maxDepth?: number) {
6665}
6766
6867async function main ( ) {
69- await exec ( 'ls -la' ) ;
70- const gitRoot = pathlib . resolve ( process . cwd ( ) ) ;
71-
72- core . info ( `git root is ${ gitRoot } ` ) ;
68+ const { stdout } = await getExecOutput ( 'git rev-parse --show-toplevel' ) ;
69+ const gitRoot = stdout . trim ( ) ;
7370
7471 const results = await Promise . all (
7572 Object . entries ( {
0 commit comments