Skip to content

Commit 128df42

Browse files
committed
Publish url fix
1 parent f41b339 commit 128df42

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ jobs:
3232
- name: Run publish without tag
3333
run: npx . publish "./test" --webhook "${{ secrets.DISCORD_WEBHOOK }}" --access-token "${{ secrets.NPM_TOKEN }}" --version+hash
3434

35-
- name: Run publish with another tag
36-
run: npx . publish "./test" --webhook "${{ secrets.DISCORD_WEBHOOK }}" --access-token "${{ secrets.NPM_TOKEN }}" --version+hash --tag github-2
37-
3835
- name: Run publish without commit hash
3936
run: npx . publish "./test" --webhook "${{ secrets.DISCORD_WEBHOOK }}" --access-token "${{ secrets.NPM_TOKEN }}"
37+
38+
- name: Just add a tag
39+
run: npx . publish "./test" --webhook "${{ secrets.DISCORD_WEBHOOK }}" --access-token "${{ secrets.NPM_TOKEN }}" --tag github-2

src/publish.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ export async function publish(args) {
127127
}
128128

129129
const htmlUrl = args.registry?.includes("npmjs") ? `https://www.npmjs.com/package/${packageJson.name}` : (args.registry + `/${packageJson.name}`);
130+
const htmlUrlMarkdown = `[${htmlUrl.replaceAll("http://", "").replaceAll("https://", "")}](<${htmlUrl}>)`;
130131

131132
// publish package
132133
let packageVersionPublished = null;
@@ -149,7 +150,7 @@ export async function publish(args) {
149150
if (!needsPublish) {
150151
logger.info(`💡 Package ${packageJson.name}@${packageJson.version} already published.`);
151152
if (webhook) {
152-
await sendMessageToWebhook(webhook, `💡 **Package already published** \`${packageJson.name}@${packageJson.version}\` at [${htmlUrl}](<${htmlUrl}>)`);
153+
await sendMessageToWebhook(webhook, `💡 **Package already published** \`${packageJson.name}@${packageJson.version}\` at ${htmlUrlMarkdown}`);
153154
}
154155
}
155156
else {
@@ -166,7 +167,7 @@ export async function publish(args) {
166167
if (res.success) {
167168
logger.info(`📦 Package ${packageJson.name}@${packageJson.version} published successfully: ${htmlUrl}`);
168169
if (webhook) {
169-
await sendMessageToWebhook(webhook, `📦 **Package published successfully** \`${packageJson.name}@${packageJson.version}\` to [${htmlUrl}](<${htmlUrl}>)`);
170+
await sendMessageToWebhook(webhook, `📦 **Package published successfully** \`${packageJson.name}@${packageJson.version}\` to ${htmlUrlMarkdown}`);
170171
}
171172
}
172173
else {

test/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "publish-helper-test-package-2",
2+
"name": "publish-helper-test-package",
33
"version": "1.0.0",
44
"main": "index.js",
55
"license": "ISC"

0 commit comments

Comments
 (0)