forked from github/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Populate product-landing "What's new" section using GitHub Changelog (g…
…ithub#18328) Co-authored-by: Jason Etcovitch <[email protected]> Co-authored-by: Rachael Sewell <[email protected]> Co-authored-by: Sarah Schneider <[email protected]>
- Loading branch information
1 parent
9b3eb7d
commit bbd9f03
Showing
43 changed files
with
292 additions
and
320 deletions.
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
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,42 @@ | ||
const Parser = require('rss-parser') | ||
|
||
async function getRssFeed (url) { | ||
const parser = new Parser({ timeout: 5000 }) | ||
const feedUrl = `${url}/feed` | ||
let feed | ||
|
||
try { | ||
feed = await parser.parseURL(feedUrl) | ||
} catch (err) { | ||
console.error(`cannot get ${feedUrl}: ${err.message}`) | ||
return | ||
} | ||
|
||
return feed | ||
} | ||
|
||
async function getChangelogItems (prefix, feed) { | ||
if (!feed || !feed.items) { | ||
console.log(feed) | ||
console.error('feed is not valid or has no items') | ||
return | ||
} | ||
|
||
// only show the first 3 posts | ||
const changelog = feed.items | ||
.slice(0, 3) | ||
.map(item => { | ||
// remove the prefix if it exists (Ex: 'GitHub Actions: '), where the colon and expected whitespace should be hardcoded. | ||
const title = prefix ? item.title.replace(new RegExp(`^${prefix}`), '') : item.title | ||
return { | ||
// capitalize the first letter of the title | ||
title: title.trim().charAt(0).toUpperCase() + title.slice(1), | ||
date: item.isoDate, | ||
href: item.guid | ||
} | ||
}) | ||
|
||
return changelog | ||
} | ||
|
||
module.exports = { getRssFeed, getChangelogItems } |
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,13 @@ | ||
const { getRssFeed, getChangelogItems } = require('../../lib/changelog') | ||
|
||
module.exports = async function whatsNewChangelog (req, res, next) { | ||
if (!req.context.page) return next() | ||
if (!req.context.page.changelog) return next() | ||
req.context.changelogUrl = req.context.page.changelog.label === 'education' | ||
? 'https://github.blog/category/community/education' | ||
: `https://github.blog/changelog/label/${req.context.page.changelog.label}` | ||
|
||
const feed = await getRssFeed(req.context.changelogUrl) | ||
req.context.whatsNewChangelog = await getChangelogItems(req.context.page.changelog.prefix, feed) | ||
return next() | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,103 @@ | ||
<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" | ||
xmlns:content="http://purl.org/rss/1.0/modules/content/" | ||
xmlns:wfw="http://wellformedweb.org/CommentAPI/" | ||
xmlns:dc="http://purl.org/dc/elements/1.1/" | ||
xmlns:atom="http://www.w3.org/2005/Atom" | ||
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" | ||
xmlns:slash="http://purl.org/rss/1.0/modules/slash/" | ||
|
||
xmlns:georss="http://www.georss.org/georss" | ||
xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" | ||
> | ||
|
||
<channel> | ||
<title>api – The GitHub Blog</title> | ||
<atom:link href="https://github.blog/changelog/label/api/feed/" rel="self" type="application/rss+xml" /> | ||
<link>https://github.blog</link> | ||
<description>Updates, ideas, and inspiration from GitHub to help developers build and design software.</description> | ||
<lastBuildDate>Thu, 01 Apr 2021 20:48:29 +0000</lastBuildDate> | ||
<language>en-US</language> | ||
<sy:updatePeriod> | ||
hourly </sy:updatePeriod> | ||
<sy:updateFrequency> | ||
1 </sy:updateFrequency> | ||
<generator>https://wordpress.org/?v=5.7</generator> | ||
|
||
<image> | ||
<url>https://github.blog/wp-content/uploads/2019/01/cropped-github-favicon-512.png?fit=32%2C32</url> | ||
<title>api – The GitHub Blog</title> | ||
<link>https://github.blog</link> | ||
<width>32</width> | ||
<height>32</height> | ||
</image> | ||
<site xmlns="com-wordpress:feed-additions:1">153214340</site> <item> | ||
<title>Authentication token format updates are generally available</title> | ||
<link>https://github.blog/changelog/2021-03-31-authentication-token-format-updates-are-generally-available</link> | ||
|
||
<dc:creator><![CDATA[phanatic]]></dc:creator> | ||
<pubDate>Wed, 31 Mar 2021 22:22:03 +0000</pubDate> | ||
<guid isPermaLink="false">https://github.blog/changelog/2021-03-31-authentication-token-format-updates-are-generally-available</guid> | ||
|
||
<description><![CDATA[Authentication token format updates are generally available]]></description> | ||
<content:encoded><![CDATA[<p>As we <a href="https://github.blog/changelog/2021-03-04-authentication-token-format-updates">announced previously</a>, the format of GitHub authentication tokens has changed. The following token types are affected:</p> | ||
<ul> | ||
<li><a href="https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token">Personal Access Tokens</a></li> | ||
<li><a href="https://docs.github.com/en/developers/apps/authorizing-oauth-apps">OAuth Access Tokens</a></li> | ||
<li><a href="https://docs.github.com/en/developers/apps/identifying-and-authorizing-users-for-github-apps">GitHub App User-to-Server Tokens</a></li> | ||
<li><a href="https://docs.github.com/en/developers/apps/authenticating-with-github-apps#authenticating-as-an-installation">GitHub App Server-to-Server Tokens</a></li> | ||
<li><a href="https://docs.github.com/en/developers/apps/refreshing-user-to-server-access-tokens">Refresh Tokens</a></li> | ||
</ul> | ||
<p>If you use any of these tokens, we encourage you to reset them now. This will give you additional security benefits and allow <a href="https://docs.github.com/en/code-security/secret-security/about-secret-scanning">Secret Scanning</a> to detect the tokens. </p> | ||
<p>Notably, the token formats now include the following updates:</p> | ||
<ul> | ||
<li>The character set changed from <code>[a-f0-9]</code> to <code>[A-Za-z0-9_]</code></li> | ||
<li>The format now includes a prefix for each token type: | ||
<ul> | ||
<li><code>ghp_</code> for Personal Access Tokens</li> | ||
<li><code>gho_</code> for OAuth Access tokens</li> | ||
<li><code>ghu_</code> for GitHub App user-to-server tokens</li> | ||
<li><code>ghs_</code> for GitHub App server-to-server tokens</li> | ||
<li><code>ghr_</code> for GitHub App refresh tokens</li> | ||
</ul> | ||
</li> | ||
</ul> | ||
<p>The length of our tokens is remaining the same for now. However, GitHub tokens will likely increase in length in future updates, so integrators should plan to support tokens up to 255 characters after June 1, 2021.</p> | ||
]]></content:encoded> | ||
|
||
|
||
|
||
<post-id xmlns="com-wordpress:feed-additions:1">57117</post-id> </item> | ||
<item> | ||
<title>Compare REST API now supports pagination</title> | ||
<link>https://github.blog/changelog/2021-03-22-compare-rest-api-now-supports-pagination</link> | ||
|
||
<dc:creator><![CDATA[phanatic]]></dc:creator> | ||
<pubDate>Tue, 23 Mar 2021 02:49:54 +0000</pubDate> | ||
<guid isPermaLink="false">https://github.blog/changelog/2021-03-22-compare-rest-api-now-supports-pagination</guid> | ||
|
||
<description><![CDATA[Compare REST API now supports pagination]]></description> | ||
<content:encoded><![CDATA[<p>The <a href="https://docs.github.com/rest/reference/repos#compare-two-commits">"Compare two commits"</a> REST API, which returns a list of commits reachable from one commit (or branch) but not reachable from another, now supports pagination. It can also now return the results for comparisons over 250 commits.</p> | ||
<p>To learn more, see the <a href="https://docs.github.com/rest/reference/repos#compare-two-commits">compare two commits</a> API reference or the guide for <a href="https://docs.github.com/en/rest/guides/traversing-with-pagination">using pagination</a>.</p> | ||
]]></content:encoded> | ||
|
||
|
||
|
||
<post-id xmlns="com-wordpress:feed-additions:1">56979</post-id> </item> | ||
<item> | ||
<title>GitHub Discussions GraphQL API public beta</title> | ||
<link>https://github.blog/changelog/2021-02-23-github-discussions-graphql-api-public-beta</link> | ||
|
||
<dc:creator><![CDATA[phanatic]]></dc:creator> | ||
<pubDate>Tue, 23 Feb 2021 18:21:40 +0000</pubDate> | ||
<guid isPermaLink="false">https://github.blog/changelog/2021-02-23-github-discussions-graphql-api-public-beta</guid> | ||
|
||
<description><![CDATA[GitHub Discussions GraphQL API public beta]]></description> | ||
<content:encoded><![CDATA[<p>The GitHub Discussions GraphQL API public beta is now available. Get started with the <a href="https://docs.github.com/en/graphql/guides/using-the-graphql-api-for-discussions">GitHub Discussions API</a>.</p> | ||
<p>For questions or feedback, visit <a href="https://github.com/github/feedback/discussions/categories/discussions-feedback">GitHub Discussions feedback</a>.</p> | ||
]]></content:encoded> | ||
|
||
|
||
|
||
<post-id xmlns="com-wordpress:feed-additions:1">56364</post-id> </item> | ||
</channel> | ||
</rss> |
Oops, something went wrong.