@@ -64,39 +64,40 @@ function getContext() {
6464export async function run ( ) : Promise < string > {
6565 const { goModDir, octokit, depPrefix, isPullRequest } = getContext ( ) ;
6666
67+ core . debug ( `Go module directory: ${ goModDir } ` ) ;
68+ core . debug ( `Dependency prefix filter: ${ depPrefix || "none" } ` ) ;
69+ core . debug ( `Pull request mode: ${ isPullRequest } ` ) ;
70+
6771 let depsToValidate = await getDeps ( goModDir , depPrefix ) ;
6872 if ( isPullRequest ) {
6973 core . info (
7074 "Running in pull request mode, filtering dependencies to validate based on changed files and only checking for pseudo-versions." ,
7175 ) ;
7276 const pr = github . context . payload . pull_request ;
73- if ( ! pr ) {
77+ if ( ! pr || ! pr . number ) {
7478 throw new Error ( "Expected pull request context to be present" ) ;
7579 }
76- const base : string = pr . base . sha ;
77- const head : string = pr . head . sha ;
78- const { owner, repo } = github . context . repo ;
7980
81+ const { owner, repo } = github . context . repo ;
8082 const changedFiles = await getChangedGoModFiles (
8183 octokit ,
82- base ,
83- head ,
84+ pr . number ,
8485 owner ,
8586 repo ,
8687 depPrefix ,
8788 ) ;
8889
8990 core . debug (
90- `Changed files: ${ JSON . stringify ( changedFiles . map ( ( f ) => f . filename ) ) } ` ,
91+ `Filtered changed files: ${ JSON . stringify ( changedFiles . map ( ( f ) => f . filename ) ) } ` ,
9192 ) ;
9293 core . debug (
9394 `Deps to validate: ${ JSON . stringify ( depsToValidate . map ( ( d ) => d . path ) ) } ` ,
9495 ) ;
9596 depsToValidate = depsToValidate . filter ( ( d ) => {
9697 return changedFiles . some (
97- ( f ) =>
98- d . goModFilePath . includes ( f . filename ) &&
99- f . addedLines . some ( ( l ) => l . content . includes ( d . path ) ) ,
98+ ( changedFile ) =>
99+ d . goModFilePath . includes ( changedFile . filename ) &&
100+ changedFile . addedLines . some ( ( l ) => l . content . includes ( d . path ) ) ,
100101 ) ;
101102 } ) ;
102103
0 commit comments