Skip to content

Commit

Permalink
fix: download section
Browse files Browse the repository at this point in the history
  • Loading branch information
marco-ippolito committed Apr 19, 2024
1 parent f65c680 commit da383ba
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
3 changes: 1 addition & 2 deletions lib/github/templates/security-post-release.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
date: %ANNOUNCEMENT_DATE%
category: vulnerability
title: %RELEASE_DATE% Security Releases
title: %RELEASE_DATE% Security Releases
slug: %SLUG%
layout: blog-post
author: %AUTHOR%
Expand All @@ -13,7 +13,6 @@ Updates are now available for the %AFFECTED_VERSIONS% Node.js release lines for
following issues.
%DEPENDENCY_UPDATES%
%REPORTS%

## Downloads and release details

%DOWNLOADS%
16 changes: 13 additions & 3 deletions lib/security_blog.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import fs from 'node:fs';
import path from 'node:path';
import _ from 'lodash';
import nv from '@pkgjs/nv';
import {
PLACEHOLDERS,
getVulnerabilitiesJSON,
Expand Down Expand Up @@ -197,7 +198,7 @@ export default class SecurityBlog {
.replaceAll(PLACEHOLDERS.reports, await this.getReportsTemplate(content))
.replaceAll(PLACEHOLDERS.dependencyUpdates,
this.getDependencyUpdatesTemplate(dependencyUpdates))
.replaceAll(PLACEHOLDERS.downloads, this.getDownloadsTemplate());
.replaceAll(PLACEHOLDERS.downloads, await this.getDownloadsTemplate(affectedVersions));
}

async getReportsTemplate(content) {
Expand Down Expand Up @@ -265,8 +266,17 @@ export default class SecurityBlog {
return template;
}

getDownloadsTemplate() {
return '';
async getDownloadsTemplate(affectedVersions) {
let template = '';
const versionsToBeReleased = (await nv('supported')).filter(
(v) => affectedVersions.split(', ').includes(`${v.major}.x`)
);
for (const version of versionsToBeReleased) {
const v = `v${version.major}.${version.minor}.${Number(version.patch) + 1}`;
template += `- [Node.js ${v}](/blog/release/${v}/)\n`;
}

return template;
}

getSlug(releaseDate) {
Expand Down

0 comments on commit da383ba

Please sign in to comment.