Skip to content

Commit b63da04

Browse files
authored
Merge pull request #24 from selfagency/dev
2 parents 1dbf665 + 04d32b8 commit b63da04

File tree

5 files changed

+31
-17
lines changed

5 files changed

+31
-17
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
path: ~/slackfeedbot
4646
key: slackfeedbot-cache
4747
- name: NYT
48-
uses: 'selfagency/[email protected].0'
48+
uses: 'selfagency/[email protected].2'
4949
with:
5050
rss: 'https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml'
5151
slack_webhook: ${{ secrets.SLACK_WEBHOOK }}
@@ -64,7 +64,7 @@ jobs:
6464
runs-on: ubuntu-latest
6565
steps:
6666
- name: NYT
67-
uses: 'selfagency/[email protected].0'
67+
uses: 'selfagency/[email protected].2'
6868
with:
6969
rss: 'https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml'
7070
slack_webhook: ${{ secrets.SLACK_WEBHOOK }}
@@ -88,7 +88,7 @@ jobs:
8888
path: ~/slackfeedbot
8989
key: slackfeedbot-cache
9090
- name: NYT
91-
uses: 'selfagency/[email protected].0'
91+
uses: 'selfagency/[email protected].2'
9292
with:
9393
rss: 'https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml'
9494
slack_webhook: ${{ secrets.SLACK_WEBHOOK }}
@@ -113,13 +113,13 @@ jobs:
113113
path: ~/slackfeedbot
114114
key: slackfeedbot-cache
115115
- name: LAT
116-
uses: 'selfagency/[email protected].0'
116+
uses: 'selfagency/[email protected].2'
117117
with:
118118
rss: 'https://www.latimes.com/rss2.0.xml'
119119
slack_webhook: ${{ secrets.SLACK_WEBHOOK }}
120120
cache_dir: '~/slackfeedbot'
121121
- name: WaPo
122-
uses: 'selfagency/[email protected].0'
122+
uses: 'selfagency/[email protected].2'
123123
with:
124124
rss: 'https://feeds.washingtonpost.com/rss/homepage'
125125
slack_webhook: ${{ secrets.SLACK_WEBHOOK }}

action.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,18 @@ const run = async () => {
8686
let published = [];
8787
if (cacheDir) {
8888
debug(`Retrieving previously published entries`);
89-
published = JSON.stringify(await read(cachePath, 'utf8'));
90-
91-
toSend = rss.items.filter(item => {
92-
return !published.find(pubbed => pubbed === hash(JSON.stringify(item.title + item.description)));
93-
});
89+
try {
90+
published = JSON.stringify(await read(cachePath, 'utf8'));
91+
92+
toSend = rss.items.filter(item => {
93+
return !published.find(pubbed => pubbed === hash(JSON.stringify(item.title + item.description)));
94+
});
95+
} catch (err) {
96+
debug(err.message);
97+
toSend = rss.items.filter(item => {
98+
return dayjs(item.created).isAfter(dayjs().subtract(60, 'minute'));
99+
});
100+
}
94101
} else {
95102
toSend = rss.items.filter(item => {
96103
return dayjs(item.created).isAfter(dayjs().subtract(interval, 'minute'));

dist/index.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23559,11 +23559,18 @@ const run = async () => {
2355923559
let published = [];
2356023560
if (cacheDir) {
2356123561
debug(`Retrieving previously published entries`);
23562-
published = JSON.stringify(await read(cachePath, 'utf8'));
23562+
try {
23563+
published = JSON.stringify(await read(cachePath, 'utf8'));
2356323564

23564-
toSend = rss.items.filter(item => {
23565-
return !published.find(pubbed => pubbed === hash(JSON.stringify(item.title + item.description)));
23566-
});
23565+
toSend = rss.items.filter(item => {
23566+
return !published.find(pubbed => pubbed === hash(JSON.stringify(item.title + item.description)));
23567+
});
23568+
} catch (err) {
23569+
debug(err.message);
23570+
toSend = rss.items.filter(item => {
23571+
return dayjs_min(item.created).isAfter(dayjs_min().subtract(60, 'minute'));
23572+
});
23573+
}
2356723574
} else {
2356823575
toSend = rss.items.filter(item => {
2356923576
return dayjs_min(item.created).isAfter(dayjs_min().subtract(interval, 'minute'));

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "slackfeedbot",
3-
"version": "1.2.1",
3+
"version": "1.2.2",
44
"license": "MIT",
55
"author": "Daniel Sieradski <[email protected]>",
66
"description": "Push RSS feed updates to Slack via GitHub Actions",

0 commit comments

Comments
 (0)