Skip to content

Commit 60b220b

Browse files
committed
fix: resolve JetBrains plugin verifier compatibility issues and optimize workflows
1 parent 7c72ebb commit 60b220b

File tree

2 files changed

+29
-49
lines changed

2 files changed

+29
-49
lines changed

.github/workflows/release.yml

Lines changed: 8 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ jobs:
192192
PRIVATE_KEY_PASSWORD: ${{ secrets.PRIVATE_KEY_PASSWORD }}
193193
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
194194

195-
- name: Comment on release with marketplace link
195+
- name: Update release with marketplace link
196196
uses: actions/github-script@v6
197197
with:
198198
script: |
@@ -201,42 +201,13 @@ jobs:
201201
repo: context.repo.repo,
202202
tag: 'v${{ needs.validate-version.outputs.version }}'
203203
});
204-
205-
await github.rest.issues.createComment({
206-
issue_number: release.data.id,
204+
205+
// Update release body to include marketplace link
206+
const marketplaceLink = '\n\n---\n\n🎉 **Plugin Published!**\n\nThe plugin has been successfully published to the JetBrains Marketplace.\n\n📦 [View on Marketplace](https://plugins.jetbrains.com/plugin/org.zhavoronkov.openrouter)';
207+
208+
await github.rest.repos.updateRelease({
207209
owner: context.repo.owner,
208210
repo: context.repo.repo,
209-
body: '🎉 **Plugin Published!**\n\nThe plugin has been successfully published to the JetBrains Marketplace.\n\n📦 [View on Marketplace](https://plugins.jetbrains.com/plugin/org.zhavoronkov.openrouter)'
211+
release_id: release.data.id,
212+
body: release.data.body + marketplaceLink
210213
});
211-
212-
update-documentation:
213-
needs: [validate-version, publish-to-marketplace]
214-
runs-on: ubuntu-latest
215-
if: always() && needs.publish-to-marketplace.result == 'success'
216-
217-
steps:
218-
- name: Checkout code
219-
uses: actions/checkout@v4
220-
with:
221-
token: ${{ secrets.GITHUB_TOKEN }}
222-
223-
- name: Update README badges
224-
run: |
225-
# Update version badge in README.md
226-
sed -i "s/version-[0-9.]*/version-${{ needs.validate-version.outputs.version }}/g" README.md
227-
228-
# Update changelog reference
229-
echo "## [${{ needs.validate-version.outputs.version }}] - $(date +%Y-%m-%d)" >> TEMP_CHANGELOG.md
230-
echo "" >> TEMP_CHANGELOG.md
231-
cat changelog.md >> TEMP_CHANGELOG.md
232-
echo "" >> TEMP_CHANGELOG.md
233-
cat CHANGELOG.md >> TEMP_CHANGELOG.md
234-
mv TEMP_CHANGELOG.md CHANGELOG.md
235-
236-
- name: Commit documentation updates
237-
run: |
238-
git config --local user.email "action@github.com"
239-
git config --local user.name "GitHub Action"
240-
git add README.md CHANGELOG.md
241-
git commit -m "docs: update documentation for release ${{ needs.validate-version.outputs.version }}" || exit 0
242-
git push

src/main/kotlin/org/zhavoronkov/openrouter/integration/AIAssistantIntegrationHelper.kt

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ object AIAssistantIntegrationHelper {
2121
/**
2222
* Checks if JetBrains AI Assistant plugin is installed and enabled
2323
*/
24+
@Suppress("DEPRECATION") // isEnabled() is deprecated but replacement not available in 2023.2
2425
fun isAIAssistantAvailable(): Boolean {
2526
return try {
2627
val pluginId = PluginId.getId(AI_ASSISTANT_PLUGIN_ID)
@@ -202,21 +203,29 @@ object AIAssistantIntegrationHelper {
202203
private fun handleWizardAction(project: Project?, status: IntegrationStatus) {
203204
when (status) {
204205
IntegrationStatus.AI_ASSISTANT_NOT_AVAILABLE -> {
205-
// Open plugin marketplace
206+
// Open plugin marketplace using ActionManager
206207
try {
207-
val action = com.intellij.ide.actions.ShowPluginManagerAction()
208-
val dataContext = if (project != null) {
209-
com.intellij.openapi.actionSystem.impl.SimpleDataContext.getProjectContext(project)
210-
} else {
211-
com.intellij.openapi.actionSystem.impl.SimpleDataContext.EMPTY_CONTEXT
212-
}
213-
action.actionPerformed(
214-
com.intellij.openapi.actionSystem.AnActionEvent.createFromDataContext(
215-
"",
208+
val actionManager = com.intellij.openapi.actionSystem.ActionManager.getInstance()
209+
val action = actionManager.getAction("WelcomeScreen.Plugins")
210+
?: actionManager.getAction("ShowPluginManager")
211+
212+
if (action != null) {
213+
val dataContext = if (project != null) {
214+
com.intellij.openapi.actionSystem.impl.SimpleDataContext.getProjectContext(project)
215+
} else {
216+
com.intellij.openapi.actionSystem.impl.SimpleDataContext.EMPTY_CONTEXT
217+
}
218+
219+
actionManager.tryToExecute(
220+
action,
221+
com.intellij.openapi.ui.playback.commands.ActionCommand.getInputEvent("ShowPluginManager"),
222+
null,
216223
null,
217-
dataContext
224+
true
218225
)
219-
)
226+
} else {
227+
throw IllegalStateException("Plugin manager action not found")
228+
}
220229
} catch (e: Exception) {
221230
PluginLogger.Service.error("Failed to open plugin marketplace", e)
222231
Messages.showErrorDialog(

0 commit comments

Comments
 (0)