-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1791b30
commit 8e8b1bc
Showing
7 changed files
with
67 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import got from 'got' | ||
import { buildRFC822Date, overwriteConfig, composeFeedItem, getFeedContent, overwriteFeedContent, getConfig, generateRetroRequestUrl, parseRetrospectiveContent, generateRetroUIUrl } from '../utils/index.js' | ||
|
||
// Collect new retrospective | ||
const { retrospective: currentConfig, breakDelimiter } = getConfig() | ||
const url = generateRetroRequestUrl(currentConfig.nextDay) | ||
|
||
try { | ||
const content = await got(url).text() | ||
const data = parseRetrospectiveContent(content) | ||
const retrospective = composeFeedItem({ | ||
title: data.title, | ||
description: `<![CDATA[<p>${data.description}</p>]]>`, | ||
pubDate: buildRFC822Date(data.lastDay), | ||
link: generateRetroUIUrl(data.lastDay), | ||
guid: generateRetroUIUrl(data.lastDay) | ||
}) | ||
// Add the new item to the feed | ||
const feedContent = getFeedContent() | ||
const [before, after] = feedContent.split(breakDelimiter) | ||
const updatedFeedContent = `${before}${breakDelimiter}${retrospective}${after}` | ||
overwriteFeedContent(updatedFeedContent) | ||
|
||
// Overwrite config with new dates | ||
const config = getConfig() | ||
overwriteConfig({ | ||
...config, | ||
retrospective: { | ||
lastDay: data.lastDay, | ||
nextDay: data.nextDay | ||
} | ||
}) | ||
} catch (error) { | ||
console.log("Retrospective not found or generated and error, so we're not updating the feed.") | ||
console.log("Configuration for the retrospective won't be updated either.") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters