Skip to content

Commit 93c080b

Browse files
committed
publish content write with tag
1 parent 3d66daa commit 93c080b

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
timeout-minutes: 5
1111
permissions:
12-
contents: read
12+
contents: write
1313
id-token: write
1414
steps:
1515
- uses: actions/checkout@v4

src/publish.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,8 +449,13 @@ export async function publish(args) {
449449
}
450450
else {
451451
logger.error(`❌ Failed to create git tag: ${res.error}`);
452+
const errorStr = res.error?.toString() || res.output?.toString() || '';
453+
let errorMsg = `❌ **Failed to create git tag** \`${tagName}\`:`;
454+
if (errorStr.includes('Permission') || errorStr.includes('denied') || errorStr.includes('403')) {
455+
errorMsg += `\n⚠️ Add \`contents: write\` permission to your workflow`;
456+
}
452457
if (webhook) {
453-
await sendMessageToWebhookWithCodeblock(webhook, `❌ **Failed to create git tag** \`${tagName}\`:`, res.error, { logger });
458+
await sendMessageToWebhookWithCodeblock(webhook, errorMsg, res.error, { logger });
454459
}
455460
}
456461
}

0 commit comments

Comments
 (0)