@@ -31,14 +31,23 @@ async function fetchUserInfo(
3131 'Content-Type' : 'application/json'
3232 }
3333 } )
34-
3534 if ( ! response . ok ) {
36- throw new Error ( `HTTP error! status: ${ response . status } ` )
35+ if ( response . status >= 400 ) {
36+ core . warning ( `User '${ username } ' won't be credited - no ORCID associated with their github account` )
37+ } else {
38+ throw new Error ( `HTTP error! status: ${ response . status } ` )
39+ }
40+ return 'unknown'
3741 }
3842
3943 const data = ( await response . json ( ) ) as { orcid_id ?: string }
44+
45+ if ( ! data ?. orcid_id ) {
46+ core . notice ( `No ORCID found for user '${ username } ' in API response` )
47+ return 'unknown'
48+ }
4049
41- return data ? .orcid_id || 'unknown'
50+ return data . orcid_id
4251 } catch ( error ) {
4352 core . error (
4453 `Failed to fetch user info for ${ username } : ${ error instanceof Error ? error . message : 'Unknown error' } `
@@ -62,9 +71,17 @@ async function processCommits(
6271 payload . commits . map ( async ( commit : any ) => {
6372 const username = commit . author ?. username || commit . committer ?. username
6473 if ( ! username ) {
65- throw new Error ( 'No username found in the commit' )
74+ core . warning ( `Skipping commit ${ commit . id } - no username associated` )
75+ return null
6676 }
77+
6778 const orcid = await fetchUserInfo ( username , userInfoConfig )
79+
80+ if ( orcid === 'unknown' ) {
81+ core . info ( `Skipping report for ${ username } - no ORCID available` )
82+ return null
83+ }
84+
6885 return {
6986 curator_orcid : orcid ,
7087 entity_uri : `${ repo . html_url } /commit/${ commit . id } ` ,
@@ -75,7 +92,7 @@ async function processCommits(
7592 }
7693 } )
7794 )
78- return reports
95+ return reports . filter ( ( report ) : report is Report => report !== null )
7996}
8097
8198async function sendToApi (
0 commit comments