Skip to content

Commit d539def

Browse files
committed
fix wintendo newlines
1 parent bc76c64 commit d539def

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

block-formatter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as logfmt from 'logfmt';
22
import matchAll from 'string.prototype.matchall'
33

44
export const findCodeBlocks = (source: string): ([string, number])[] => {
5-
const pat = /(^```\n)(.+?)^```/gms;
5+
const pat = /(^```\r?\n)(.+?)^```/gms;
66
return Array.from(matchAll(source, pat), (m: any) => [m[2], m.index + m[1].length]);
77
}
88

dist/index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10714,6 +10714,8 @@ __nccwpck_require__.r(__webpack_exports__);
1071410714
var core = __nccwpck_require__(2186);
1071510715
// EXTERNAL MODULE: ./node_modules/@actions/github/lib/github.js
1071610716
var github = __nccwpck_require__(5438);
10717+
// EXTERNAL MODULE: external "fs"
10718+
var external_fs_ = __nccwpck_require__(5747);
1071710719
// EXTERNAL MODULE: ./node_modules/logfmt/logfmt.js
1071810720
var logfmt = __nccwpck_require__(5578);
1071910721
// EXTERNAL MODULE: ./node_modules/string.prototype.matchall/index.js
@@ -10723,7 +10725,7 @@ var string_prototype_matchall_default = /*#__PURE__*/__nccwpck_require__.n(strin
1072310725

1072410726

1072510727
const findCodeBlocks = (source) => {
10726-
const pat = /(^```\n)(.+?)^```/gms;
10728+
const pat = /(^```\r?\n)(.+?)^```/gms;
1072710729
return Array.from(string_prototype_matchall_default()(source, pat), (m) => [m[2], m.index + m[1].length]);
1072810730
};
1072910731
const formatLogItem = (time, level, msg, fields) => {
@@ -10784,6 +10786,7 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume
1078410786

1078510787

1078610788

10789+
1078710790
(() => __awaiter(void 0, void 0, void 0, function* () {
1078810791
const authToken = core.getInput('repo-token');
1078910792
const octokit = github.getOctokit(authToken);
@@ -10802,6 +10805,7 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume
1080210805
const issue = response.data;
1080310806
console.log(`Issue title: ${issue.title}`);
1080410807
console.log(`Issue body:\n${issue.body}\n`);
10808+
external_fs_.writeFileSync('issue_body.txt', issue.body);
1080510809
console.log(`Patching issue body...`);
1080610810
const [patchedBody, patchCount] = patchCodeBlocks(issue.body);
1080710811
if (patchCount < 1) {
@@ -10822,7 +10826,7 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume
1082210826
if (saveResponse.status != 200) {
1082310827
core.setFailed(`Failed to save issue data. Server responded with ${response.status}`);
1082410828
}
10825-
}))().catch(error => core.setFailed(error.message));
10829+
}))().catch(error => core.setFailed(`${error}`));
1082610830

1082710831
})();
1082810832

0 commit comments

Comments
 (0)