@@ -10740,6 +10740,7 @@ const formatLogItem = (time, level, msg, fields) => {
10740
10740
} ;
10741
10741
const patchCodeBlocks = ( source ) => {
10742
10742
const blocks = findCodeBlocks ( source ) ;
10743
+ console . log ( `Blocks found: ${ blocks . length } ` ) ;
10743
10744
let patched = '' ;
10744
10745
let logFmtMatches = 0 ;
10745
10746
let sourcePos = 0 ;
@@ -10756,6 +10757,7 @@ const patchCodeBlocks = (source) => {
10756
10757
return formatLogItem ( time , level , msg , fields ) ;
10757
10758
}
10758
10759
else {
10760
+ console . log ( `!LF: ${ line } ` ) ;
10759
10761
// Did not include the usual log fields, probably not in logfmt, just skip it
10760
10762
return line ;
10761
10763
}
@@ -10786,6 +10788,9 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume
10786
10788
const authToken = core . getInput ( 'repo-token' ) ;
10787
10789
const octokit = github . getOctokit ( authToken ) ;
10788
10790
const { owner, repo, number } = github . context . issue ;
10791
+ console . log ( `Repo: ${ owner } /${ repo } ` ) ;
10792
+ console . log ( `Issue: ${ number } ` ) ;
10793
+ console . log ( 'Retrieving issue details...' ) ;
10789
10794
const response = yield octokit . request ( "GET /repos/{owner}/{repo}/issues/{issue_number}" , {
10790
10795
owner,
10791
10796
repo,
@@ -10795,17 +10800,28 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume
10795
10800
core . setFailed ( `Failed to fetch issue data. Server responded with ${ response . status } ` ) ;
10796
10801
}
10797
10802
const issue = response . data ;
10803
+ console . log ( `Issue title: ${ issue . title } ` ) ;
10804
+ console . log ( `Issue body:\n${ issue . body } \n` ) ;
10805
+ console . log ( `Patching issue body...` ) ;
10798
10806
const [ patchedBody , patchCount ] = patchCodeBlocks ( issue . body ) ;
10799
10807
if ( patchCount < 1 ) {
10808
+ console . log ( 'No lines where patched. Skipping update.' ) ;
10800
10809
// No need to update the issue body, since we found no logfmt lines
10801
10810
return ;
10802
10811
}
10803
- yield octokit . request ( 'PATCH /repos/{owner}/{repo}/issues/{issue_number}' , {
10812
+ console . log ( `Patch count: ${ patchCount } ` ) ;
10813
+ console . log ( `Saving issue body...` ) ;
10814
+ const saveResponse = yield octokit . request ( 'PATCH /repos/{owner}/{repo}/issues/{issue_number}' , {
10804
10815
owner,
10805
10816
repo,
10806
10817
issue_number : number ,
10807
10818
body : patchedBody ,
10808
10819
} ) ;
10820
+ console . log ( 'Response:' ) ;
10821
+ console . log ( saveResponse . data ) ;
10822
+ if ( saveResponse . status != 200 ) {
10823
+ core . setFailed ( `Failed to save issue data. Server responded with ${ response . status } ` ) ;
10824
+ }
10809
10825
} ) ) ( ) . catch ( error => core . setFailed ( error . message ) ) ;
10810
10826
10811
10827
} ) ( ) ;
0 commit comments