Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 15 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

## Installation 🔨

### Preresequisits
### Prerequisites

- install python3 (make sure to include pip in install)
- Install Python 3 (make sure to include pip in the installation)
- Install [glab](https://gitlab.com/gitlab-org/cli)
- Authorize via glab `glab auth login` (you will need Gitlab access token, SSH recomended)
- Authorize via glab `glab auth login` (you will need a GitLab access token, SSH recommended)
- `pip install inquirer` or `pip3 install inquirer`
- `pip install requests` or `pip3 install requests`

Expand All @@ -25,13 +25,13 @@
- In configs folder copy example files like so:
`cp configs/templates.json.example configs/templates.json`
`cp configs/config.ini.example configs/config.ini`
- In `configs.ini` you have to paste id of your group in Gitlab to `group_id` (This is for fetching milestones and epics)
- In `configs/config.ini` you have to paste the ID of your GitLab group into `group_id` (this is for fetching milestones and epics)
- You can adjust templates now, or play with them later (however, you have to remove comments from json before running the command).

#### Alias

To run gitHappens script anywhere in filesystem, make sure to create an alias.
Add following line to your `.bashrc` or `.zshrc` file
To run the gitHappens script from anywhere in your filesystem, create an alias.
Add the following line to your `.bashrc` or `.zshrc` file:
`alias gh='python3 ~/<path-to-githappens-project>/gitHappens.py'`

Run `source ~/.zshrc` or restart terminal.
Expand All @@ -42,11 +42,11 @@ Run `source ~/.zshrc` or restart terminal.

- Project selection is made automatically if you run script in same path as your project is located.
- You can specify project id or URL-encoded path as script argument e.g.: `--project_id=123456`
- If no of steps above happen, program will prompt you with question about project_id
- If none of the options above apply, the program will prompt you for `project_id`.

#### Issue creation for multiple projects at once

This feature is useful if you have to create issue on both backend and frontend project for same thing.
This feature is useful if you have to create an issue on both backend and frontend projects for the same work.

- You can specify list of ids in `templates.json` file.

Expand All @@ -72,17 +72,17 @@ Issue templates are located in `configs/templates.json`.

### Excluding features

If you don't want to include some settings you use following flags:
If you don't want to include some settings, use the following flags:

- `--no_epic` - no epic will be selected or prompted
- `--no_milestone` - no milestone will be selected or prompted

### Only issue

If you are in a hurry and want to create issue for later without merge request and branch this flag is for you.
If you are in a hurry and want to create an issue for later without a merge request and branch, this flag is for you.

- `--only_issue` - no merge request nor branch will be created.
You can achive same functionality with adding onlyIssue key to `templates.json` file.
You can achieve the same functionality by adding the `onlyIssue` key to the `templates.json` file.

```
...
Expand Down Expand Up @@ -127,10 +127,11 @@ gh review
To also enable **auto-merge when the pipeline succeeds**, add `--auto_merge` or `-am` flag:

```
gh review -auto_merge
gh review --auto_merge

gh review -am
```

### Manually selecting reviewers

To manually select reviewers for your merge request, use the `--select` flag with the review command:
Expand Down Expand Up @@ -175,52 +176,21 @@ To configure production deployment detection, add project-specific mappings to y

**Note:** The command only considers deployments with "success" status to ensure accurate last deployment information.


You can check when the last successful production deployment occurred:

```
gh last deploy
```

This command shows information about the most recent successful production deployment including timing, pipeline details, and how long ago it happened.

#### Configuration

To configure production deployment detection, add project-specific mappings to your `templates.json`:

```json
{
"templates": [...],
"reviewers": [...],
"productionMappings": {
"your_project_id": {
"stage": "production:deploy",
"job": "deploy-to-production"
},
"another_project_id": {
"stage": "deploy",
"job": "production:deploy"
}
}
}
```

**Note:** The command only considers deployments with "success" status to ensure accurate last deployment information.
### Flag help

If you run just `gh` (or whatever alias you set) or `gh --help` you will see all available flags and a short explanation.

## Troubleshooting 🪲🔫

### Recieving 401 Unauthorized error
### Receiving 401 Unauthorized error

If you get `glab: 401 Unauthorized (HTTP 401)` when using GitHappens, you must repeat `glab auth login`
and then reopen your terminal.

## Contributing 🫂🫶

Every contributor is welcome.
I suggest checking Gitlab's official API documentation: https://docs.gitlab.com/ee/api/merge_requests.html
I suggest checking GitLab's official API documentation: https://docs.gitlab.com/ee/api/merge_requests.html

## Donating 💜

Expand Down