From 8be56fdc2158ee4c81462a6efa60f1dd9f62e130 Mon Sep 17 00:00:00 2001 From: calleelqy Date: Wed, 13 May 2026 09:12:41 -0500 Subject: [PATCH] docs: clean up README setup guide --- README.md | 123 ++++++++++++++++++++---------------------------------- 1 file changed, 46 insertions(+), 77 deletions(-) diff --git a/README.md b/README.md index c8fef2e..eedcb97 100644 --- a/README.md +++ b/README.md @@ -8,31 +8,41 @@ ## Installation 🔨 -### Preresequisits +### Prerequisites -- install python3 (make sure to include pip in install) -- Install [glab](https://gitlab.com/gitlab-org/cli) -- Authorize via glab `glab auth login` (you will need Gitlab access token, SSH recomended) -- `pip install inquirer` or `pip3 install inquirer` -- `pip install requests` or `pip3 install requests` +- Install Python 3 with pip. +- Install [glab](https://gitlab.com/gitlab-org/cli). +- Authorize glab with `glab auth login`. You will need a GitLab access token, and SSH is recommended for repository access. +- Install Python dependencies: + +```sh +pip install -r requirements.txt +``` ### Setup -- Clone repository to your local machine to whatever destination you want (just don't delete it later) +- Clone this repository to a local path that you plan to keep. The shell alias points to this checkout, so moving or deleting it later will break the command. #### Setup configs -- 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) -- You can adjust templates now, or play with them later (however, you have to remove comments from json before running the command). +- In the `configs` folder, copy the example files: + +```sh +cp configs/templates.json.example configs/templates.json +cp configs/config.ini.example configs/config.ini +``` + +- In `configs/config.ini`, paste your GitLab group ID into `group_id`. This is used for fetching milestones and epics. +- You can adjust templates now, or later. Remove comments from `configs/templates.json` before running the command because JSON does not support comments. #### Alias -To run gitHappens script anywhere in filesystem, make sure to create an alias. -Add following line to your `.bashrc` or `.zshrc` file -`alias gh='python3 ~//gitHappens.py'` +To run gitHappens script anywhere in the filesystem, create an alias. +Add the following line to your `.bashrc` or `.zshrc` file: + +```sh +alias gh='python3 /path/to/githappens/gitHappens.py' +``` Run `source ~/.zshrc` or restart terminal. @@ -40,9 +50,9 @@ Run `source ~/.zshrc` or restart terminal. ### Project selection -- 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 +- Project selection is made automatically if you run the script from the same path as your project. +- You can specify a project ID or URL-encoded path as a script argument, for example: `--project_id=123456`. +- If neither of the steps above apply, the program prompts you for a `project_id`. #### Issue creation for multiple projects at once @@ -50,14 +60,12 @@ This feature is useful if you have to create issue on both backend and frontend - You can specify list of ids in `templates.json` file. -``` -... +```json { "name": "Feature issue for API and frontend", - ... + "labels": ["feature::Confirmed"], "projectIds": [123, 456] } -... ``` ### Milestone selection @@ -68,7 +76,7 @@ Milestone is set to current by default. If you want to pick it manually, pass `- Issue templates are located in `configs/templates.json`. -**Make sure that names of templates are unique** +Make sure that template names are unique. ### Excluding features @@ -81,24 +89,22 @@ If you don't want to include some settings you use following flags: If you are in a hurry and want to create issue for later without 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. +- `--only_issue` - no merge request or branch will be created. + You can achieve the same behavior by adding an `onlyIssue` key to `templates.json`. -``` -... +```json { "name": "Feature issue for later", - ... + "labels": ["feature::Confirmed"], "onlyIssue": true } -... ``` ### Open merge request in browser You can open merge request for current checked out branch in browser with command: -``` +```sh gh open ``` @@ -106,47 +112,42 @@ gh open You can set default reviewers in templates.json file. -``` -... +```json { - "templates": [ - ... - ], - ... + "templates": [], "reviewers": [234, 456, 678] } -... ``` To submit merge request into review run command: -``` +```sh gh review ``` To also enable **auto-merge when the pipeline succeeds**, add `--auto_merge` or `-am` flag: -``` -gh review –-auto_merge +```sh +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: -``` +```sh gh review --select ``` You will be prompted with an interactive list of reviewers to choose from. - ### Last production deployment You can check when the last successful production deployment occurred: -``` +```sh gh last deploy ``` @@ -175,44 +176,13 @@ 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. @@ -220,9 +190,8 @@ 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 💜 Make sure to check this project on [OpenPledge](https://app.openpledge.io/repositories/zigcBenx/gitHappens). -