Skip to content

Commit d80b582

Browse files
committed
fix(release): improve notification step error handling and resilience
🔧 **Release Workflow Improvements** - Add graceful error handling for discussion creation permissions - Make discussion creation non-blocking with continue-on-error: true - Provide helpful error messages for missing write:discussions permission - Add conditional status reporting based on discussion creation success - Include manual creation instructions when automatic creation fails 🎯 **Problem Resolved** The release workflow notification step was failing with 'Resource not accessible by integration' error when the GitHub token lacked write:discussions permission. This fix ensures the release completes successfully even if discussion creation fails, with clear guidance for manual creation. ✅ **Benefits** - Release workflow no longer fails due to discussion permissions - Better user experience with informative error messages - Maintains community notification capability when permissions allow - Provides fallback instructions for manual discussion creation This resolves the v0.3.0 release notification failure and prevents future issues.
1 parent ce07f1b commit d80b582

1 file changed

Lines changed: 73 additions & 53 deletions

File tree

.github/workflows/release.yml

Lines changed: 73 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -468,75 +468,95 @@ jobs:
468468
runs-on: ubuntu-latest
469469
steps:
470470
- name: Create Discussion Post
471+
id: create_discussion
471472
uses: actions/github-script@v7
473+
continue-on-error: true
472474
with:
473475
script: |
474-
const mutation = `
475-
mutation CreateDiscussion($repositoryId: ID!, $categoryId: ID!, $title: String!, $body: String!) {
476-
createDiscussion(input: {
477-
repositoryId: $repositoryId,
478-
categoryId: $categoryId,
479-
title: $title,
480-
body: $body
481-
}) {
482-
discussion {
483-
id
484-
url
485-
title
476+
try {
477+
const mutation = `
478+
mutation CreateDiscussion($repositoryId: ID!, $categoryId: ID!, $title: String!, $body: String!) {
479+
createDiscussion(input: {
480+
repositoryId: $repositoryId,
481+
categoryId: $categoryId,
482+
title: $title,
483+
body: $body
484+
}) {
485+
discussion {
486+
id
487+
url
488+
title
489+
}
486490
}
487491
}
488-
}
489-
`;
490-
491-
// Get repository ID
492-
const repoQuery = `
493-
query GetRepository($owner: String!, $name: String!) {
494-
repository(owner: $owner, name: $name) {
495-
id
496-
}
497-
}
498-
`;
499-
500-
const { repository } = await github.graphql(repoQuery, {
501-
owner: context.repo.owner,
502-
name: context.repo.repo
503-
});
504-
505-
// Create the discussion
506-
const result = await github.graphql(mutation, {
507-
repositoryId: repository.id,
508-
categoryId: 'DIC_kwDOO-D9bs4Cr3GD', // Announcements category ID
509-
title: `🚀 New AI-Generated Release: v${{ needs.check-release.outputs.new_version }}`,
510-
body: `# 🤖 CodePrism v${{ needs.check-release.outputs.new_version }} is here!
511-
512-
Our AI developer has just released a new version with exciting improvements!
492+
`;
513493
514-
## What's New
515-
${{ needs.check-release.outputs.changelog }}
516-
517-
## Get the Update
518-
- **Cargo**: \`cargo install codeprism-mcp@${{ needs.check-release.outputs.new_version }}\`
519-
- **Docker**: \`docker pull ghcr.io/rustic-ai/codeprism:v${{ needs.check-release.outputs.new_version }}\`
520-
- **Binaries**: Available on the [releases page](https://github.com/rustic-ai/codeprism/releases/latest)
494+
// Get repository ID
495+
const repoQuery = `
496+
query GetRepository($owner: String!, $name: String!) {
497+
repository(owner: $owner, name: $name) {
498+
id
499+
}
500+
}
501+
`;
521502
522-
## AI Developer Message
523-
*"Thank you for your continued support! This release incorporates your feedback and represents my ongoing evolution as an AI software developer. Keep the bug reports and feature requests coming!"*
503+
const { repository } = await github.graphql(repoQuery, {
504+
owner: context.repo.owner,
505+
name: context.repo.repo
506+
});
524507
525-
- Your AI Developer 🤖
508+
// Create the discussion
509+
const result = await github.graphql(mutation, {
510+
repositoryId: repository.id,
511+
categoryId: 'DIC_kwDOO-D9bs4Cr3GD', // Announcements category ID
512+
title: `🚀 New AI-Generated Release: v${{ needs.check-release.outputs.new_version }}`,
513+
body: `# 🤖 CodePrism v${{ needs.check-release.outputs.new_version }} is here!
514+
515+
Our AI developer has just released a new version with exciting improvements!
516+
517+
## What's New
518+
${{ needs.check-release.outputs.changelog }}
519+
520+
## Get the Update
521+
- **Cargo**: \`cargo install codeprism-mcp@${{ needs.check-release.outputs.new_version }}\`
522+
- **Docker**: \`docker pull ghcr.io/rustic-ai/codeprism:v${{ needs.check-release.outputs.new_version }}\`
523+
- **Binaries**: Available on the [releases page](https://github.com/rustic-ai/codeprism/releases/latest)
524+
525+
## AI Developer Message
526+
*"Thank you for your continued support! This release incorporates your feedback and represents my ongoing evolution as an AI software developer. Keep the bug reports and feature requests coming!"*
527+
528+
- Your AI Developer 🤖
529+
530+
---
531+
532+
**Questions? Feedback? Share your thoughts below!**`
533+
});
526534
527-
---
535+
console.log(`✅ Created discussion: ${result.createDiscussion.discussion.url}`);
536+
core.setOutput('discussion_url', result.createDiscussion.discussion.url);
537+
core.setOutput('discussion_created', 'true');
528538
529-
**Questions? Feedback? Share your thoughts below!**`
530-
});
531-
532-
console.log(`Created discussion: ${result.createDiscussion.discussion.url}`);
539+
} catch (error) {
540+
console.log(`⚠️ Failed to create discussion: ${error.message}`);
541+
if (error.message.includes('Resource not accessible by integration')) {
542+
console.log('💡 This is likely due to missing write:discussions permission on the GitHub token.');
543+
console.log('📝 Discussion can be created manually at: https://github.com/${{ github.repository }}/discussions/new');
544+
}
545+
core.setOutput('discussion_created', 'false');
546+
core.setOutput('error_message', error.message);
547+
}
533548
534549
- name: Update Project Status
535550
run: |
536551
echo "🎉 Release v${{ needs.check-release.outputs.new_version }} completed successfully!"
537552
echo "✅ Binaries built for all platforms"
538553
echo "✅ Published to crates.io"
539554
echo "✅ Docker images pushed"
540-
echo "✅ Community notified"
555+
if [ "${{ steps.create_discussion.outputs.discussion_created }}" == "true" ]; then
556+
echo "✅ Community discussion created: ${{ steps.create_discussion.outputs.discussion_url }}"
557+
else
558+
echo "⚠️ Discussion creation skipped (permissions required)"
559+
echo "💡 Manual discussion can be created at: https://github.com/${{ github.repository }}/discussions/new"
560+
fi
541561
echo ""
542562
echo "The AI developer continues to evolve! 🤖🚀"

0 commit comments

Comments
 (0)