@@ -25,7 +25,6 @@ import {
2525 generate_changeset ,
2626 validate_changelog ,
2727} from "./utils" ;
28- import { createShorthandPropertyAssignment } from "typescript" ;
2928
3029const dev_only_ignore_globs = [
3130 "!**/test/**" ,
@@ -44,7 +43,7 @@ type PackageJson = Packages["packages"][0]["packageJson"] & {
4443} ;
4544
4645async function run ( ) {
47- // console.log(JSON.stringify(context, null, 2));
46+ console . log ( JSON . stringify ( context , null , 2 ) ) ;
4847 const branch_name = getInput ( "branch_name" ) ;
4948
5049 if ( branch_name . startsWith ( "changeset-release/" ) ) {
@@ -93,43 +92,59 @@ async function run() {
9392 ) ;
9493
9594 // Check if PR has the approved label
96- const has_approved_label = labels . some ( l => l . name === 'changeset:approved' ) ;
97-
95+ const has_approved_label = labels . some (
96+ ( l ) => l . name === "changeset:approved"
97+ ) ;
98+
9899 info ( `[Manual Mode] Full context:` ) ;
99- info ( JSON . stringify ( {
100- pr_number : pull_request_number ,
101- labels : labels . map ( l => l . name ) ,
102- has_approved_label,
103- comment_exists : ! ! comment ,
104- comment_id : comment ?. id ,
105- comment_author : comment ?. author ,
106- comment_editor : comment ?. editor ,
107- comment_lastEditedAt : comment ?. lastEditedAt ,
108- changeset_path
109- } , null , 2 ) ) ;
100+ info (
101+ JSON . stringify (
102+ {
103+ pr_number : pull_request_number ,
104+ labels : labels . map ( ( l ) => l . name ) ,
105+ has_approved_label,
106+ comment_exists : ! ! comment ,
107+ comment_id : comment ?. id ,
108+ comment_author : comment ?. author ,
109+ comment_editor : comment ?. editor ,
110+ comment_lastEditedAt : comment ?. lastEditedAt ,
111+ changeset_path,
112+ } ,
113+ null ,
114+ 2
115+ )
116+ ) ;
110117
111118 if ( comment ?. body ) {
112119 const wasEdited = comment . lastEditedAt !== null ;
113-
120+
114121 const selection = check_for_manual_selection_and_approval (
115122 comment . body ,
116123 wasEdited ,
117124 comment . editor ,
118125 has_approved_label
119126 ) ;
120-
127+
121128 info ( `[Manual Mode] Checkbox analysis:` ) ;
122- info ( JSON . stringify ( {
123- wasEdited,
124- editor : comment . editor ,
125- checkbox_checked : selection . checkbox_checked ,
126- has_approved_label,
127- should_toggle_label : selection . should_toggle_label
128- } , null , 2 ) ) ;
129-
129+ info (
130+ JSON . stringify (
131+ {
132+ wasEdited,
133+ editor : comment . editor ,
134+ checkbox_checked : selection . checkbox_checked ,
135+ has_approved_label,
136+ should_toggle_label : selection . should_toggle_label ,
137+ } ,
138+ null ,
139+ 2
140+ )
141+ ) ;
142+
130143 // Handle label toggling if needed
131144 if ( selection . should_toggle_label ) {
132- const approved_label_id = await client . get_or_create_label ( 'changeset:approved' ) ;
145+ const approved_label_id = await client . get_or_create_label (
146+ "changeset:approved"
147+ ) ;
133148 if ( approved_label_id ) {
134149 if ( selection . checkbox_checked ) {
135150 info ( `[Manual Mode] Adding changeset:approved label` ) ;
@@ -139,7 +154,9 @@ async function run() {
139154 await client . remove_label ( pr_id , approved_label_id ) ;
140155 }
141156 } else {
142- warning ( `[Manual Mode] Could not find or create changeset:approved label` ) ;
157+ warning (
158+ `[Manual Mode] Could not find or create changeset:approved label`
159+ ) ;
143160 }
144161 }
145162 }
@@ -172,7 +189,7 @@ async function run() {
172189 changeset_content : old_changeset_content ,
173190 changeset_url : `https://github.com/${ source_repo_name } /edit/${ source_branch_name } /${ changeset_path } ` ,
174191 previous_comment : comment ?. body ,
175- has_approved_label : labels . some ( l => l . name === ' changeset:approved' ) ,
192+ has_approved_label : labels . some ( ( l ) => l . name === " changeset:approved" ) ,
176193 changelog_entry_type,
177194 } ) ;
178195
@@ -199,42 +216,56 @@ async function run() {
199216
200217 let packages_versions : undefined | [ string , string | boolean ] [ ] = undefined ;
201218 let manual_package_selection = false ;
202-
219+
203220 // Check if PR has the approved label
204- const has_approved_label = labels . some ( l => l . name === 'changeset:approved' ) ;
221+ const has_approved_label = labels . some (
222+ ( l ) => l . name === "changeset:approved"
223+ ) ;
205224
206225 info ( `[Normal Mode] Full context:` ) ;
207- info ( JSON . stringify ( {
208- pr_number : pull_request_number ,
209- labels : labels . map ( l => l . name ) ,
210- has_approved_label,
211- comment_exists : ! ! comment ,
212- comment_id : comment ?. id ,
213- comment_author : comment ?. author ,
214- comment_editor : comment ?. editor ,
215- comment_lastEditedAt : comment ?. lastEditedAt ,
216- changeset_path
217- } , null , 2 ) ) ;
226+ info (
227+ JSON . stringify (
228+ {
229+ pr_number : pull_request_number ,
230+ labels : labels . map ( ( l ) => l . name ) ,
231+ has_approved_label,
232+ comment_exists : ! ! comment ,
233+ comment_id : comment ?. id ,
234+ comment_author : comment ?. author ,
235+ comment_editor : comment ?. editor ,
236+ comment_lastEditedAt : comment ?. lastEditedAt ,
237+ changeset_path,
238+ } ,
239+ null ,
240+ 2
241+ )
242+ ) ;
218243
219244 if ( comment ?. body ) {
220245 const wasEdited = comment . lastEditedAt !== null ;
221-
246+
222247 const selection = check_for_manual_selection_and_approval (
223248 comment . body ,
224249 wasEdited ,
225250 comment . editor ,
226251 has_approved_label
227252 ) ;
228-
253+
229254 info ( `[Normal Mode] Checkbox analysis:` ) ;
230- info ( JSON . stringify ( {
231- wasEdited,
232- editor : comment . editor ,
233- checkbox_checked : selection . checkbox_checked ,
234- has_approved_label,
235- should_toggle_label : selection . should_toggle_label ,
236- manual_package_selection : selection . manual_package_selection
237- } , null , 2 ) ) ;
255+ info (
256+ JSON . stringify (
257+ {
258+ wasEdited,
259+ editor : comment . editor ,
260+ checkbox_checked : selection . checkbox_checked ,
261+ has_approved_label,
262+ should_toggle_label : selection . should_toggle_label ,
263+ manual_package_selection : selection . manual_package_selection ,
264+ } ,
265+ null ,
266+ 2
267+ )
268+ ) ;
238269
239270 manual_package_selection = selection . manual_package_selection ;
240271
@@ -246,10 +277,12 @@ async function run() {
246277 packages_versions = selection . versions ;
247278 info ( `[Normal Mode] Using manual package versions from comment` ) ;
248279 }
249-
280+
250281 // Handle label toggling if needed
251282 if ( selection . should_toggle_label ) {
252- const approved_label_id = await client . get_or_create_label ( 'changeset:approved' ) ;
283+ const approved_label_id = await client . get_or_create_label (
284+ "changeset:approved"
285+ ) ;
253286 if ( approved_label_id ) {
254287 if ( selection . checkbox_checked ) {
255288 info ( `[Normal Mode] Adding changeset:approved label` ) ;
@@ -259,7 +292,9 @@ async function run() {
259292 await client . remove_label ( pr_id , approved_label_id ) ;
260293 }
261294 } else {
262- warning ( `[Normal Mode] Could not find or create changeset:approved label` ) ;
295+ warning (
296+ `[Normal Mode] Could not find or create changeset:approved label`
297+ ) ;
263298 }
264299 }
265300 }
0 commit comments