Skip to content

Commit

Permalink
feat:mark outdated actions (#122)
Browse files Browse the repository at this point in the history
  • Loading branch information
cunla authored Apr 17, 2024
1 parent 091766e commit 99bae7e
Show file tree
Hide file tree
Showing 25 changed files with 621 additions and 31 deletions.
17 changes: 10 additions & 7 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,22 @@ title: ''
labels: ''
assignees: ''
---

**Describe the bug**
A clear and concise description of what the bug is.
### Describe the bug
A clear and concise description of what the bug is.
Add a screenshot if it is relevant.

**Describe the bug:**
<!-- A clear and concise description of what the bug is. -->

**Steps to reproduce:**
### Steps to reproduce

<!-- Steps to reproduce the issue. -->
### Expected behavior

**Expected behavior:**
<!-- A clear and concise description of what you expected to happen. -->

**Additional context:**
<!-- Add any other context about the problem here. -->
### Additional context

Plugin version:
IDE:
OS:
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@

## Unreleased

## 1.21.0

### 🚀 Features

- Highlight outdated actions in workflow files. #122
- Quick fix action to update to the latest major version of the action. #122
- Error reporting directly to GitHub issues.

### 🧰 Maintenance

- Update bug-report template.

## 1.20.0

### 🚀 Features
Expand Down
37 changes: 26 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,35 @@ GitHub Actions Manager for JetBrains IDEs

# Screenshots

Horizontal | Vertical
Horizontal | Vertical

:--------------------------------------------------------------------------:|:-------------------------:
![](docs/screenshot-new-ui-light.png) ![](docs/screenshot-new-ui-dark.png) | ![](docs/screenshot-vertical.jpg)
![](docs/screenshot-new-ui-light.png) ![](docs/screenshot-new-ui-dark.png) | ![](docs/screenshot-vertical.jpg)

![](docs/outdated-action-version.jpg)

![](docs/quickfix-action.jpg)


<!-- Plugin description -->
This plugin creates a toolbar on JetBrains products (IntelliJ, PyCharm, ...)
where you can view GitHub workflow runs of the repository.
This plugin is a good alternative to alt-tabbing for every time you push
some changes to the branch and want to see whether the repository's checks
are passing on your changes.
This plugin creates a tool-window on JetBrains products (IntelliJ, PyCharm, ...) where you can view GitHub workflow runs
of the repository.
This plugin is a good alternative to alt-tabbing for every time you push some changes to the branch and want to see
whether the repository's checks are passing on your changes.

# GitHub Actions Tool Window Features

- View the latest workflow runs of the repository.
- Filter the workflow runs by the current branch.
- Filter the workflow runs by status, user who triggered the workflow, and the workflow name.
- Trigger a workflow from the tool window.
- Rerun a workflow run.
- Open the workflow file in the project.

# Editing GitHub Workflow files Features

- Highlight outdated actions.
- Update to latest major version of the action.

# Sponsor

Expand Down Expand Up @@ -64,7 +83,3 @@ best way to get a bug fixed is to contribute a pull request.

If you'd like to help out, you can start with any of the issues
labeled with `Help wanted`.

#

Inspired by [Otanikotani's github-actions-tab](https://github.com/Otanikotani/view-github-actions-idea-plugin).
Binary file added docs/outdated-action-version.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/quickfix-action.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pluginGroup=com.dsoftware.ghmanager
pluginName=github-actions-manager

# SemVer format -> https://semver.org
pluginVersion=1.20.0
pluginVersion=1.21.0

# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
pluginSinceBuild=241.13688.18
Expand Down
9 changes: 9 additions & 0 deletions src/main/graphql/getLatestRelease.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
query LatestRelease($owner:String!,$name:String!) {
repository(owner:$owner, name:$name){
latestRelease{
tag{
name
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package com.dsoftware.ghmanager

import com.intellij.ide.BrowserUtil
import com.intellij.ide.plugins.PluginManagerCore.getPlugin
import com.intellij.openapi.application.ApplicationInfo
import com.intellij.openapi.diagnostic.ErrorReportSubmitter
import com.intellij.openapi.diagnostic.IdeaLoggingEvent
import com.intellij.openapi.diagnostic.SubmittedReportInfo
import com.intellij.openapi.util.SystemInfo
import com.intellij.util.Consumer
import java.awt.Component
import java.net.URLEncoder
import java.nio.charset.StandardCharsets

internal class PluginErrorReportSubmitter : ErrorReportSubmitter() {
private val REPORT_URL =
"https://github.com/cunla/ghactions-manager/issues/new?assignees=&labels=&projects=&template=bug_report.md"

override fun getReportActionText(): String {
return "Report Issue on Plugin Issues Tracker"
}

override fun submit(
events: Array<IdeaLoggingEvent>,
additionalInfo: String?,
parentComponent: Component,
consumer: Consumer<in SubmittedReportInfo?>
): Boolean {
val event = events[0]
val throwableTitle = event.throwableText.lines()[0]

val sb = StringBuilder(REPORT_URL)

val titleEncoded = URLEncoder.encode(event.throwable?.message ?: throwableTitle, StandardCharsets.UTF_8)
sb.append("&title=${titleEncoded}")

val pluginVersion = getPlugin(pluginDescriptor.pluginId)?.version ?: "unknown"

val body = """
### Describe the bug
A clear and concise description of what the bug is.
Add a screenshot if it is relevant.
**Describe the bug:**
${additionalInfo ?: ""}
${event.message ?: ""}
#### Stack trace
{{{PLACEHOLDER}}}
### Steps to reproduce
<!-- Steps to reproduce the issue. -->
### Expected behavior
<!-- A clear and concise description of what you expected to happen. -->
### Additional context
Plugin version: $pluginVersion
IDE: ${ApplicationInfo.getInstance().fullApplicationName} (${ApplicationInfo.getInstance().build.asString()})
OS: ${SystemInfo.getOsNameAndVersion()}
""".trimIndent().replace("{{{PLACEHOLDER}}}", event.throwableText)
sb.append("&body=${URLEncoder.encode(body, StandardCharsets.UTF_8)}")
BrowserUtil.browse(sb.toString())

consumer.consume(SubmittedReportInfo(SubmittedReportInfo.SubmissionStatus.NEW_ISSUE))
return true
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.dsoftware.ghmanager.data

import com.dsoftware.ghmanager.ui.GhActionsMgrToolWindowContent
import com.dsoftware.ghmanager.ui.settings.GhActionsSettingsService
import com.intellij.openapi.Disposable
import com.intellij.openapi.components.service
import com.intellij.openapi.project.Project
Expand All @@ -23,6 +24,8 @@ interface GhActionsService {
val gitHubAccounts: Set<GithubAccount>
val accountsState: StateFlow<Collection<GithubAccount>>
val toolWindowsJobMap: MutableMap<ToolWindow, Job>


fun guessAccountForRepository(repo: GHGitRepositoryMapping): GithubAccount? {
return gitHubAccounts.firstOrNull { it.server.equals(repo.repository.serverPath, true) }
}
Expand All @@ -46,8 +49,9 @@ interface GhActionsService {
}
}

open class GhActionsServiceImpl(project: Project, override val coroutineScope: CoroutineScope) : GhActionsService,
Disposable {
open class GhActionsServiceImpl(
project: Project, override val coroutineScope: CoroutineScope
) : GhActionsService, Disposable {
private val repositoriesManager = project.service<GHHostedRepositoriesManager>()
private val accountManager = service<GHAccountManager>()

Expand Down
Loading

0 comments on commit 99bae7e

Please sign in to comment.