From e23ade88baef5edf75b85b2e94ae4b81276b0d93 Mon Sep 17 00:00:00 2001 From: Remus Mate Date: Wed, 20 Jul 2022 15:28:58 +1000 Subject: [PATCH] Correctly write to action summary --- CHANGELOG.md | 6 ++++++ package.json | 2 +- src/index.ts | 10 +++++----- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fd04a7b..4db98a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # changesets-snapshot +## 0.0.6 + +### Patch Changes + +- Correctly write to action summary + ## 0.0.5 ### Patch Changes diff --git a/package.json b/package.json index 6b50a6c..2dbc2fd 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "0.0.5", + "version": "0.0.6", "name": "changesets-snapshot", "main": "dist/index.js", "license": "MIT", diff --git a/src/index.ts b/src/index.ts index 3038e8f..946601b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -7,7 +7,7 @@ import { ensureNpmrc } from './npm-utils'; import { run, runPublish } from './run'; import { execWithOutput } from './utils'; -function annotate({ +async function writeSummary({ title, message, codeBlock, @@ -16,11 +16,11 @@ function annotate({ message: string; codeBlock?: string; }) { - core.summary.addHeading(title, 3); - core.summary.addRaw(message); + core.summary.addHeading(title, 3).addRaw(message); if (codeBlock) { core.summary.addCodeBlock(codeBlock); } + await core.summary.write(); } export const publishSnapshot = async () => { @@ -69,7 +69,7 @@ export const publishSnapshot = async () => { '\nNo changesets found. In order to publish a snapshot version, you must have at least one changeset committed.\n', ); - annotate({ + await writeSummary({ title: '⚠️ No snapshot published', message: 'No changesets found, skipping publish. If you want to publish a snapshot version, you may need to add a changeset for the relevant package.', @@ -91,7 +91,7 @@ export const publishSnapshot = async () => { result.publishedPackages.length === 1 ? 'snapshot' : 'snapshots'; for (const { name, version } of result.publishedPackages) { - annotate({ + await writeSummary({ title: `🦋 New ${pkgNoun} published!`, message: `Version: \`${name}@${version}\``, codeBlock: getCommand(packageManager, 'add', [