forked from raycast/extensions
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Gitlab: Fix epics handling + Mark as todo action for issue and MRs (r…
…aycast#199) * fix duplications in epics list * fix crash when an epic is in the todo list * add toast message for successful closing a todo * add action to mark as todo for issues and epics * fix possible exception if no project is defined in a todo * update readme
- Loading branch information
Showing
7 changed files
with
187 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,102 @@ | ||
# GitLab integration for Raycast | ||
<div align="center"> | ||
<img | ||
src="https://github.com/raycast/extensions/blob/main/extensions/gitlab/assets/gitlab.png?raw=true" | ||
width="50" | ||
/> | ||
|
||
## Prerequisites | ||
<h1> | ||
GitLab | ||
</h1> | ||
|
||
call `npm ci` | ||
Raycast extension to create, search and modify issues, manage merge requests, projects and more. | ||
|
||
<p> | ||
<a href="https://www.raycast.com/tonka3000/gitlab"> | ||
<img src="https://img.shields.io/badge/Raycast-store-red.svg" | ||
alt="Find this extension on the Raycast store" | ||
/> | ||
</a> | ||
<a | ||
href="https://github.com/raycast/extensions/blob/master/LICENSE" | ||
> | ||
<img | ||
src="https://img.shields.io/badge/license-MIT-blue.svg" | ||
alt="raycast-extensions is released under the MIT license." | ||
/> | ||
</a> | ||
<img | ||
src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" | ||
alt="PRs welcome!" | ||
/> | ||
<a href="https://twitter.com/intent/follow?screen_name=tonka_2000"> | ||
<img | ||
src="https://img.shields.io/twitter/follow/tonka_2000.svg?label=Follow%20@tonka_2000" | ||
alt="Follow @tonka_2000" | ||
/> | ||
</a> | ||
<a href="https://open.vscode.dev/organization/repository"> | ||
<img | ||
src="https://open.vscode.dev/badges/open-in-vscode.svg" | ||
alt="Open in Visual Studio Code" | ||
/> | ||
</a> | ||
</p> | ||
</div> | ||
|
||
## Features | ||
|
||
- Manage your issue | ||
- Manage your assigned issues | ||
- Manage your GitLab todos | ||
- Manage your projects | ||
- Manage your epics | ||
- Manage your merge requests | ||
- Manage your reviews | ||
- Search other users | ||
|
||
and many more | ||
|
||
## How to get the access token for the GitLab API | ||
|
||
- Goto to your GitLab instance e.g. https://gitlab.com | ||
- Click on your avatar image in the right upper corner | ||
- Click on `Edit profile` | ||
- Click on `Access Tokens` on the left sidebar | ||
- Give your token a name e.g. `raycast` and set an expiration date (highly recommended) | ||
- Select your scope of choice | ||
|
||
You need at least `read_api`. When you want to make write operation via raycast, you should use `api` | ||
|
||
- Store the given access token in a secret box because GitLab want show you the key again | ||
- Go to the preferences in Raycast (or start any command of GitLab extension) | ||
- Set your GitLab instance url | ||
|
||
For gitlab.com this would be `https://gitlab.com`. | ||
Your own instance could be `https://mygitlab.org`. | ||
|
||
- Set the token from the previous step into the `API Token` field | ||
|
||
Now you should be able to manage your GitLab instance with Raycast 🚀. | ||
|
||
## API Token/Personal Access Token scope | ||
|
||
For all read only commands the `read_api` scope is enough. If you want to create/modify e.g. an issue you need | ||
the `api` scope. | ||
|
||
## Showcases | ||
|
||
### Todos | ||
|
||
![todos](https://user-images.githubusercontent.com/3163807/138604198-6afbc93b-c263-4c03-812a-fc77b63d23a1.png) | ||
|
||
### My Open Issues | ||
|
||
![issues](https://user-images.githubusercontent.com/3163807/138604241-80629c99-6b86-4034-86ad-9400610b6350.png) | ||
|
||
### My Groups | ||
|
||
![groups](https://user-images.githubusercontent.com/3163807/138604274-f25a935c-50da-435f-b332-a9a72217e6e6.png) | ||
|
||
### Epics | ||
|
||
![epcis](https://user-images.githubusercontent.com/3163807/138604310-c6292899-232f-4902-a170-f5f93db9c998.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { ActionPanel, Color, KeyboardShortcut, showToast, ToastStyle } from "@raycast/api"; | ||
import { gitlab } from "../common"; | ||
import { Epic } from "../gitlabapi"; | ||
import { GitLabIcons } from "../icons"; | ||
|
||
export function CreateEpicTodoAction(props: { epic: Epic; shortcut?: KeyboardShortcut }) { | ||
const epic = props.epic; | ||
async function handleAction() { | ||
try { | ||
await gitlab.post(`groups/${epic.group_id}/epics/${epic.iid}/todo`); | ||
showToast(ToastStyle.Success, "To do created"); | ||
} catch (error: any) { | ||
showToast( | ||
ToastStyle.Failure, | ||
"Failed to add as to do", | ||
error instanceof Error ? error.message : error.toString() | ||
); | ||
} | ||
} | ||
if (epic.state === "opened") { | ||
return ( | ||
<ActionPanel.Item | ||
title="Add a to do" | ||
shortcut={props.shortcut} | ||
icon={{ source: GitLabIcons.todo, tintColor: Color.PrimaryText }} | ||
onAction={handleAction} | ||
/> | ||
); | ||
} else { | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters