Skip to content

Commit

Permalink
fix wintendo newlines
Browse files Browse the repository at this point in the history
  • Loading branch information
piksel committed Apr 18, 2021
1 parent bc76c64 commit d539def
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion block-formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as logfmt from 'logfmt';
import matchAll from 'string.prototype.matchall'

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

Expand Down
8 changes: 6 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10714,6 +10714,8 @@ __nccwpck_require__.r(__webpack_exports__);
var core = __nccwpck_require__(2186);
// EXTERNAL MODULE: ./node_modules/@actions/github/lib/github.js
var github = __nccwpck_require__(5438);
// EXTERNAL MODULE: external "fs"
var external_fs_ = __nccwpck_require__(5747);
// EXTERNAL MODULE: ./node_modules/logfmt/logfmt.js
var logfmt = __nccwpck_require__(5578);
// EXTERNAL MODULE: ./node_modules/string.prototype.matchall/index.js
Expand All @@ -10723,7 +10725,7 @@ var string_prototype_matchall_default = /*#__PURE__*/__nccwpck_require__.n(strin


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




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

})();

Expand Down

0 comments on commit d539def

Please sign in to comment.