@@ -65,12 +65,12 @@ function parseBaseUpperBound(packageYamlPath) {
65
65
66
66
const baseDep = deps . find ( dep => dep . startsWith ( "base" ) ) ;
67
67
if ( ! baseDep ) {
68
- throw new Error ( "No base dependency found in package.yaml" ) ;
68
+ githubCore . setFailed ( "No base dependency found in package.yaml" ) ;
69
69
}
70
70
71
71
const versionConstraint = getBaseUpperBound ( baseDep ) ;
72
72
if ( ! versionConstraint ) {
73
- throw new Error ( "No upper bound for base found in package.yaml" ) ;
73
+ githubCore . setFailed ( "No upper bound for base found in package.yaml" ) ;
74
74
}
75
75
76
76
return versionConstraint ;
@@ -94,9 +94,9 @@ async function main() {
94
94
} ) . filter ( Boolean ) ;
95
95
96
96
if ( ghcupList . length > 0 ) {
97
- console . log ( `Found ${ ghcupList . length } GHC versions` ) ;
97
+ githubCore . info ( `Found ${ ghcupList . length } GHC versions` ) ;
98
98
} else {
99
- throw new Error ( 'Failed to get GHC versions from GHCup' ) ;
99
+ githubCore . setFailed ( 'Failed to get GHC versions from GHCup' ) ;
100
100
}
101
101
102
102
const validVersions = ghcupList . filter ( ghcEntry => {
@@ -121,13 +121,11 @@ async function main() {
121
121
122
122
const latestGhc = validVersions [ 0 ] . version ;
123
123
124
- console . log ( `Latest GHC under base < ${ baseUpperBound . version } : ${ latestGhc } ` ) ;
124
+ githubCore . info ( `Latest GHC under base < ${ baseUpperBound . version } : ${ latestGhc } ` ) ;
125
125
126
- const outputPath = process . env . GITHUB_OUTPUT ;
127
- fs . appendFileSync ( outputPath , `ghc-version=${ latestGhc } \n` ) ;
126
+ githubCore . setOutput ( 'ghc-version' , latestGhc ) ;
128
127
} catch ( err ) {
129
- console . error ( err ) ;
130
- process . exit ( 1 ) ;
128
+ githubCore . setFailed ( err . message ) ;
131
129
}
132
130
}
133
131
0 commit comments