@@ -19,11 +19,32 @@ module.exports = async ({ github, context }) => {
1919 let htmlContent = html . join ( '<br>' ) ;
2020
2121 try {
22- // Fetch the release by tag
22+ // Get the current ref (tag/branch) from the workflow_dispatch context
23+ let tagName = null ;
24+
25+ console . log ( 'Workflow context info:' ) ;
26+ console . log ( '- Event:' , context . eventName ) ;
27+ console . log ( '- Ref:' , context . ref ) ;
28+ console . log ( '- SHA:' , context . sha ) ;
29+
30+ // Check if we're running from a tag (eg :- refs/tags/v4.0-thbarevm)
31+ if ( context . ref && context . ref . startsWith ( 'refs/tags/' ) ) {
32+ // Extract tag name from refs/tags/v1.0.0 -> v1.0.0
33+ tagName = context . ref . replace ( 'refs/tags/' , '' ) ;
34+ console . log ( `Running from tag: ${ tagName } ` ) ;
35+ }
36+
37+ if ( ! tagName ) {
38+ throw new Error (
39+ 'Not running from a tag. Exiting without updating release.'
40+ ) ;
41+ }
42+
43+ // Get the specific release by tag
2344 const response = await github . rest . repos . getReleaseByTag ( {
2445 owner : context . repo . owner ,
2546 repo : context . repo . repo ,
26- tag : context . payload . release . tag_name
47+ tag : tagName
2748 } ) ;
2849
2950 // Update the release with the new notes
@@ -33,6 +54,10 @@ module.exports = async ({ github, context }) => {
3354 release_id : response . data . id ,
3455 body : htmlContent
3556 } ) ;
57+
58+ console . log (
59+ `Successfully updated release ${ tagName } with new deployment information`
60+ ) ;
3661 } catch ( err ) {
3762 console . error ( 'Error fetching or updating the release:' , err . message ) ;
3863 throw err ;
0 commit comments