From e5cecbac546a6f76594daa5eb00505c795f2e90e Mon Sep 17 00:00:00 2001 From: Aetherinox Date: Mon, 17 Mar 2025 12:48:16 -0700 Subject: [PATCH] ci: get existing labels in workflow --- .github/workflows/issues-scan.yml | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/.github/workflows/issues-scan.yml b/.github/workflows/issues-scan.yml index 3de72725..690e6172 100755 --- a/.github/workflows/issues-scan.yml +++ b/.github/workflows/issues-scan.yml @@ -305,15 +305,29 @@ jobs: console.log(` PR Context ............ ${ context }`) console.log(`-----------------------------------------------------------------------------------------------`) + const targetOwner = context.repo.owner; + const targetRepo = context.repo.repo; + + // Fetch labels from the source repository + const response = await github.rest.issues.listLabelsForRepo({ + owner: targetOwner, + repo: targetRepo, + }); + console.log("Labels fetched: ", response.data); + const fs = require( 'fs' ); const escape_html = ( unsafe ) => unsafe.replace( /&/g, '&' ).replace( //g, '>' ).replace( /"/g, '"' ).replace( /'/g, ''' ); - const labels = []; + const labels = response.data; - const files_List = `${{ steps.task_autocheck_changed_files_get.outputs.all_changed_files }}` || '' - const files_Array = files_List.split(',') - const branch_ref = `${ context.payload.pull_request.head.ref }` + console.log(`-----------------------------------------------------------------------------------------------`) + console.log(` PR Labels ............ ${ labels }`) + console.log(`-----------------------------------------------------------------------------------------------`) - let message = [ "\n
\n" ] + const files_List = `${{ steps.task_autocheck_changed_files_get.outputs.all_changed_files }}` || ''; + const files_Array = files_List.split(','); + const branch_ref = `${ context.payload.pull_request.head.ref }`; + + let message = [ "\n
\n" ]; message.push ( "## Automatic Self-Check - #" + context.issue.number + "\n" ); message.push ( `The details of our automated scan for your pull request are listed below. If our scan detected errors, they must be corrected before this pull request will be advanced to the review stage:\n` ); message.push ( "\n
\n\n---\n\n
\n\n" );