Skip to content

Commit

Permalink
1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sarisia committed Feb 7, 2021
1 parent 963b93c commit 287cc0b
Show file tree
Hide file tree
Showing 23 changed files with 278 additions and 77 deletions.
58 changes: 34 additions & 24 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,45 +34,53 @@ const markdown_1 = require("./markdown");
const format_1 = require("./format");
function run() {
return __awaiter(this, void 0, void 0, function* () {
const url = core.getInput('url');
if (!url) {
core.error('url is missing.');
return;
}
const file = core.getInput('file');
if (!file) {
core.error('file is missing.');
return;
}
const sort = core.getInput('sort').toLowerCase() === 'true';
const maxEntry = parseInt(core.getInput('max_entry')) || 5;
const format = process.env['INPUT_FORMAT'] || '- ${monthshort} ${02day} - [${title}](${url})';
const startFlag = core.getInput('start_flag') || '<!-- feed start -->';
const endFlag = core.getInput('end_flag') || '<!-- feed end -->';
const locale = core.getInput('locale') || 'en-US';
const timezone = core.getInput('timezone') || 'UTC';
let lines;
try {
lines = yield markdown_1.getLines(file);
}
catch (e) {
core.error(`failed to read file: ${e.message}`);
const nowrite = core.getInput('nowrite').toLowerCase() === 'true';
const url = core.getInput('url');
if (!url) {
core.setFailed('url is missing.');
return;
}
const file = core.getInput('file');
if (!file) {
if (nowrite) {
core.warning('file is missing, but nowrite is set. Continue...');
}
else {
core.setFailed('file is missing.');
return;
}
}
let lines = [];
if (file) {
try {
lines = yield markdown_1.getLines(file);
}
catch (e) {
core.setFailed(`failed to read file: ${e.message}`);
return;
}
}
let allItems;
try {
allItems = yield feed_1.getFeedItems(url);
}
catch (e) {
core.error(`failed to get feed: ${e.message}`);
core.setFailed(`failed to get feed: ${e.message}`);
return;
}
if (sort) {
try {
allItems = feed_1.sortItems(allItems);
}
catch (e) {
core.error(`failed to sort feed items: ${e.message}`);
core.setFailed(`failed to sort feed items: ${e.message}`);
return;
}
}
Expand All @@ -87,12 +95,14 @@ function run() {
core.startGroup('Dump result document');
core.info(joinedResult);
core.endGroup();
try {
yield markdown_1.write(file, joinedResult);
}
catch (e) {
core.error(`failed to write file: ${e.message}`);
return;
if (!nowrite) {
try {
yield markdown_1.write(file, joinedResult);
}
catch (e) {
core.setFailed(`failed to write file: ${e.message}`);
return;
}
}
core.info('Generating outputs...');
core.setOutput('items', items);
Expand Down
4 changes: 1 addition & 3 deletions node_modules/entities/lib/decode.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion node_modules/entities/lib/decode.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions node_modules/entities/lib/decode.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion node_modules/entities/lib/decode_codepoint.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 15 additions & 9 deletions node_modules/entities/lib/decode_codepoint.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 43 additions & 0 deletions node_modules/entities/lib/encode.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion node_modules/entities/lib/encode.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

79 changes: 71 additions & 8 deletions node_modules/entities/lib/encode.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion node_modules/entities/lib/index.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion node_modules/entities/lib/index.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 287cc0b

Please sign in to comment.