From 9ccc2f0b14d811717786064215e7d712ea09624e Mon Sep 17 00:00:00 2001 From: Leonardo Cabeza Date: Tue, 11 Aug 2020 15:41:13 -0500 Subject: [PATCH] fix(github): published broken links (#269) --- api/_utils/github/feed.ts | 8 +++-- api/superfeedr/index.ts | 8 ++--- package-lock.json | 64 +++++++++++++++++++++++---------------- package.json | 6 ++-- 4 files changed, 51 insertions(+), 35 deletions(-) diff --git a/api/_utils/github/feed.ts b/api/_utils/github/feed.ts index cc8017b..cd13101 100644 --- a/api/_utils/github/feed.ts +++ b/api/_utils/github/feed.ts @@ -11,13 +11,15 @@ interface RepoConfig { const handleGithubFeed = async ( repoConfig: RepoConfig, - tags: string[], + urls: string[], ): Promise => { if (MAIN_GROUP_ID) { const promises: Promise[] = []; const repoMainUrl = repoConfig.feed.replace('releases.atom', ''); - tags.forEach(tag => { + urls.forEach(url => { + const tag = url.match(/[\w.-]+$/gi)![0]; + const promise = sendMessage({ chatId: Number(MAIN_GROUP_ID), text: messages.githubRelease @@ -27,7 +29,7 @@ const handleGithubFeed = async ( '#{url}', repoConfig.hasChangelog ? `${repoMainUrl}blob/master/CHANGELOG.md` - : `https://github.com/${repoConfig.name}/releases/tag/${tag}`, + : url, ), }); diff --git a/api/superfeedr/index.ts b/api/superfeedr/index.ts index 39f3ee7..5662b07 100644 --- a/api/superfeedr/index.ts +++ b/api/superfeedr/index.ts @@ -14,7 +14,7 @@ Sentry.init({ dsn: SENTRY_DSN }); // Taken from https://documentation.superfeedr.com/schema.html interface Item { - title: string; + permalinkUrl: string; } /** @@ -56,12 +56,12 @@ export default async (request: NowRequest, response: NowResponse) => { const repoConfig = config.githubFeeds.find( ({ feed }) => feed === updatedFeed, ); - const tags = request.body.items.map( - (item: Item) => item.title, + const urls = request.body.items.map( + (item: Item) => item.permalinkUrl, ); if (repoConfig) { - await handleGithubFeed(repoConfig, tags); + await handleGithubFeed(repoConfig, urls); } } else { // If it isn't a github feed, it's a blog feed diff --git a/package-lock.json b/package-lock.json index 14ca9c6..a0bf089 100644 --- a/package-lock.json +++ b/package-lock.json @@ -311,6 +311,18 @@ "any-observable": "^0.3.0" } }, + "@semantic-release/changelog": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@semantic-release/changelog/-/changelog-5.0.1.tgz", + "integrity": "sha512-unvqHo5jk4dvAf2nZ3aw4imrlwQ2I50eVVvq9D47Qc3R+keNqepx1vDYwkjF8guFXnOYaYcR28yrZWno1hFbiw==", + "dev": true, + "requires": { + "@semantic-release/error": "^2.1.0", + "aggregate-error": "^3.0.0", + "fs-extra": "^9.0.0", + "lodash": "^4.17.4" + } + }, "@semantic-release/commit-analyzer": { "version": "8.0.1", "resolved": "https://registry.npmjs.org/@semantic-release/commit-analyzer/-/commit-analyzer-8.0.1.tgz", @@ -813,12 +825,12 @@ "integrity": "sha512-I99sngh224D0M7XgW1s120zxCt3VYQ3IQsuw3P3jbq5GG4yc79+ZjyKznyOGIQrflfylLgcfekeZW/vk0yng6A==" }, "@typescript-eslint/eslint-plugin": { - "version": "3.8.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-3.8.0.tgz", - "integrity": "sha512-lFb4VCDleFSR+eo4Ew+HvrJ37ZH1Y9ZyE+qyP7EiwBpcCVxwmUc5PAqhShCQ8N8U5vqYydm74nss+a0wrrCErw==", + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-3.9.0.tgz", + "integrity": "sha512-UD6b4p0/hSe1xdTvRCENSx7iQ+KR6ourlZFfYuPC7FlXEzdHuLPrEmuxZ23b2zW96KJX9Z3w05GE/wNOiEzrVg==", "dev": true, "requires": { - "@typescript-eslint/experimental-utils": "3.8.0", + "@typescript-eslint/experimental-utils": "3.9.0", "debug": "^4.1.1", "functional-red-black-tree": "^1.0.1", "regexpp": "^3.0.0", @@ -835,45 +847,45 @@ } }, "@typescript-eslint/experimental-utils": { - "version": "3.8.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-3.8.0.tgz", - "integrity": "sha512-o8T1blo1lAJE0QDsW7nSyvZHbiDzQDjINJKyB44Z3sSL39qBy5L10ScI/XwDtaiunoyKGLiY9bzRk4YjsUZl8w==", + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-3.9.0.tgz", + "integrity": "sha512-/vSHUDYizSOhrOJdjYxPNGfb4a3ibO8zd4nUKo/QBFOmxosT3cVUV7KIg8Dwi6TXlr667G7YPqFK9+VSZOorNA==", "dev": true, "requires": { "@types/json-schema": "^7.0.3", - "@typescript-eslint/types": "3.8.0", - "@typescript-eslint/typescript-estree": "3.8.0", + "@typescript-eslint/types": "3.9.0", + "@typescript-eslint/typescript-estree": "3.9.0", "eslint-scope": "^5.0.0", "eslint-utils": "^2.0.0" } }, "@typescript-eslint/parser": { - "version": "3.8.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-3.8.0.tgz", - "integrity": "sha512-u5vjOBaCsnMVQOvkKCXAmmOhyyMmFFf5dbkM3TIbg3MZ2pyv5peE4gj81UAbTHwTOXEwf7eCQTUMKrDl/+qGnA==", + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-3.9.0.tgz", + "integrity": "sha512-rDHOKb6uW2jZkHQniUQVZkixQrfsZGUCNWWbKWep4A5hGhN5dLHMUCNAWnC4tXRlHedXkTDptIpxs6e4Pz8UfA==", "dev": true, "requires": { "@types/eslint-visitor-keys": "^1.0.0", - "@typescript-eslint/experimental-utils": "3.8.0", - "@typescript-eslint/types": "3.8.0", - "@typescript-eslint/typescript-estree": "3.8.0", + "@typescript-eslint/experimental-utils": "3.9.0", + "@typescript-eslint/types": "3.9.0", + "@typescript-eslint/typescript-estree": "3.9.0", "eslint-visitor-keys": "^1.1.0" } }, "@typescript-eslint/types": { - "version": "3.8.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-3.8.0.tgz", - "integrity": "sha512-8kROmEQkv6ss9kdQ44vCN1dTrgu4Qxrd2kXr10kz2NP5T8/7JnEfYNxCpPkArbLIhhkGLZV3aVMplH1RXQRF7Q==", + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-3.9.0.tgz", + "integrity": "sha512-rb6LDr+dk9RVVXO/NJE8dT1pGlso3voNdEIN8ugm4CWM5w5GimbThCMiMl4da1t5u3YwPWEwOnKAULCZgBtBHg==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "3.8.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-3.8.0.tgz", - "integrity": "sha512-MTv9nPDhlKfclwnplRNDL44mP2SY96YmPGxmMbMy6x12I+pERcxpIUht7DXZaj4mOKKtet53wYYXU0ABaiXrLw==", + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-3.9.0.tgz", + "integrity": "sha512-N+158NKgN4rOmWVfvKOMoMFV5n8XxAliaKkArm/sOypzQ0bUL8MSnOEBW3VFIeffb/K5ce/cAV0yYhR7U4ALAA==", "dev": true, "requires": { - "@typescript-eslint/types": "3.8.0", - "@typescript-eslint/visitor-keys": "3.8.0", + "@typescript-eslint/types": "3.9.0", + "@typescript-eslint/visitor-keys": "3.9.0", "debug": "^4.1.1", "glob": "^7.1.6", "is-glob": "^4.0.1", @@ -891,9 +903,9 @@ } }, "@typescript-eslint/visitor-keys": { - "version": "3.8.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-3.8.0.tgz", - "integrity": "sha512-gfqQWyVPpT9NpLREXNR820AYwgz+Kr1GuF3nf1wxpHD6hdxI62tq03ToomFnDxY0m3pUB39IF7sil7D5TQexLA==", + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-3.9.0.tgz", + "integrity": "sha512-O1qeoGqDbu0EZUC/MZ6F1WHTIzcBVhGqDj3LhTnj65WUA548RXVxUHbYhAW9bZWfb2rnX9QsbbP5nmeJ5Z4+ng==", "dev": true, "requires": { "eslint-visitor-keys": "^1.1.0" diff --git a/package.json b/package.json index 38fed32..4dcf2ae 100644 --- a/package.json +++ b/package.json @@ -33,10 +33,11 @@ "twitter-autohook": "^1.7.2" }, "devDependencies": { + "@semantic-release/changelog": "^5.0.1", "@types/node": "^14.0.27", "@types/node-fetch": "^2.5.7", - "@typescript-eslint/eslint-plugin": "^3.8.0", - "@typescript-eslint/parser": "^3.8.0", + "@typescript-eslint/eslint-plugin": "^3.9.0", + "@typescript-eslint/parser": "^3.9.0", "eslint": "^7.6.0", "eslint-config-prettier": "^6.11.0", "eslint-plugin-prettier": "^3.1.4", @@ -77,6 +78,7 @@ } ], "@semantic-release/release-notes-generator", + "@semantic-release/changelog", "@semantic-release/github" ] }