-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixup! Feat(ci): Introduce posting changelog into the Slack channel
- Loading branch information
Showing
1 changed file
with
4 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,12 @@ | ||
/* eslint-disable no-console */ | ||
import { $, fetch, argv } from 'zx'; | ||
import dotenv from 'dotenv-safe'; | ||
import slackifyMarkdown from 'slackify-markdown'; | ||
import { simpleGit } from 'simple-git'; | ||
import gitDiffParser from 'gitdiff-parser'; | ||
|
||
/* eslint-disable no-console */ | ||
|
||
const CHANNEL = '#spirit-design-system-notifications_en'; | ||
const COLOR_CORE = '#00A58E'; | ||
const PACKAGES = [/* 'web', */ 'web-react' /* 'design-tokens', 'icons', 'codemods', 'analytics' */]; | ||
const PACKAGES = ['web', 'web-react', 'design-tokens', 'icons', 'codemods', 'analytics']; | ||
const SLACK_CHANGELOG_WEBHOOK_URL = process.env.SLACK_CHANGELOG_WEBHOOK_URL ?? ''; | ||
|
||
function getTitle(pkg) { | ||
|
@@ -120,10 +118,7 @@ async function publishChangelog(package_) { | |
await simpleGit().fetch(['origin', 'main', '--tags']); | ||
const tags = await simpleGit().tags({ '--sort': '-taggerdate' }); | ||
console.log(tags.latest); | ||
const diff = await getDiff( | ||
'@lmc-eu/[email protected]' /* tags.latest */ ?? '', | ||
changelogPath(package_), | ||
); | ||
const diff = await getDiff(tags.latest ?? '', changelogPath(package_)); | ||
const files = gitDiffParser.parse(diff); | ||
if (files.length === 0) { | ||
console.log(`No changes in ${package_}`); | ||
|
@@ -134,7 +129,7 @@ async function publishChangelog(package_) { | |
const formattedChangelog = format(changelog, package_); | ||
const slackifiedChangelog = slackifyMarkdown(formattedChangelog); | ||
|
||
if (false /* argv.dry */) { | ||
if (argv.dry) { | ||
console.info(formattedChangelog); | ||
} else { | ||
await configureWebhookURL(); | ||
|