Skip to content

Commit

Permalink
Correctly write to action summary
Browse files Browse the repository at this point in the history
  • Loading branch information
mrm007 committed Jul 20, 2022
1 parent 92226fb commit e23ade8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# changesets-snapshot

## 0.0.6

### Patch Changes

- Correctly write to action summary

## 0.0.5

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.0.5",
"version": "0.0.6",
"name": "changesets-snapshot",
"main": "dist/index.js",
"license": "MIT",
Expand Down
10 changes: 5 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 () => {
Expand Down Expand Up @@ -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.',
Expand All @@ -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', [
Expand Down

0 comments on commit e23ade8

Please sign in to comment.