Skip to content

Updated README.md #54

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
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
81 changes: 52 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Redmine GitHub plugin

_redmine_github_ is a Redmine plugin for connecting a local Redmine installation to a remote GitHub repository. The plugin allows to:
_redmine_github_ is a Redmine plugin for connecting a local Redmine installation to a remote GitHub repository.

- Syncronize remote GitHub repository to a local Git one - all Git-related Redmine features can be used
- Attach pull request (PR) status icons to issues - will change in real time, when pul request status change - created, approved, merged etc.
- Connect commit comment to issues via [Redmine commit comments keywords](<(https://www.redmine.org/projects/redmine/wiki/RedmineSettings#Referencing-issues-in-commit-messages)>)
The plugin allows to:

- Syncronize remote GitHub repository to a local Git one. All Git-related Redmine features can be used!
- Attach pull request (PR) status icons to issues. These will change in real time, when pull request status change: created, approved, merged, etc.
- Connect git commit comments to issues via Redmine's [referencing issues in commit messages](https://www.redmine.org/projects/redmine/wiki/RedmineSettings#Referencing-issues-in-commit-messages).

## Getting started

Expand All @@ -14,16 +16,17 @@ _redmine_github_ is a Redmine plugin for connecting a local Redmine installation
cd {LOCAL_REDMINE_DIRECTORY}/plugins
```

#### From downloaded release archive file

#### via Git clone

```shell
tar xvzpf redmine_github....
git clone https://github.com/agileware-jp/redmine_github.git
```

#### or via Git clone
#### or from downloaded release archive file

```shell
git clone https://github.com/agileware-jp/redmine_github.git
tar xvzpf redmine_github....
```

#### Install gems and migrate the database
Expand All @@ -34,45 +37,65 @@ bundle install
bundle exec rake redmine:plugins:migrate
```

#### Restart you Redmine
#### Restart your Redmine

After restarting check _redmine_github_ plugin is listed in `Administration->Plugins`.

### 2. Enable Github as an SCM

After restart, also check if plugin is listed in the installed Redmine plugins list - _(Administration|Plugins)_
As per [Redmine documentation](https://www.redmine.org/projects/redmine/wiki/RedmineRepositories), enable `Github` as an SCM you wish to use globally in `Administration->Settings->Repositories->Enabled SCM`.

### 2. Add the repository to Redmine
### 3. Add a Github repository to a Redmine project

For given project, in \_(Settings|Repositories|New Repository) form enter:
For given project, go to its `Settings->Repositories->New Repository` form and enter:

- _SCM_ - **Github**
- _Identifier_ - unique repository identifier
- _URL_ - GitHub repository HTTPS URL ([clone address](https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#about-remote-repositories), starting with `https://`)
- _Access Token_ - [personal access token](https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line)
- _Webhook Secret_ - [webhook secret](https://developer.github.com/webhooks/securing/)
- **SCM:** `Github`
- **Main repository:** *(Optional)*
- **Identifier:** `YOUR-UNIQUE-IDENTIFIER`
- *For example, you can simply use your Github repository's* `Repository name` *as its **Identifier** in Redmine.*
- **URL:** `https://github.com/USER|ORGANIZATION/YOUR-REPOSITORY-NAME`
- *More info: [Clone address](https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#about-remote-repositories)*
- **Access Token:** `YOUR-ACCESS-TOKEN`
- *More info: [Personal access token](https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line)*
- **Webhook Secret:** `YOUR-WEBHOOK-SECRET`
- *More info: [Webhook secret](https://developer.github.com/webhooks/securing/)*
- **Path encoding:** *(Optional)*
- **Report last commit for files and directories:** *(Optional)*

After pressing _'Create'_ button, bare-clone repository will be created inside your Redmine install directory - `{LOCAL_REDMINE_DIRECTORY}/repositories/` path.
After pressing `Create` button, a bare-clone of your Github repository will be created inside your Redmine's install directory, at `{LOCAL_REDMINE_DIRECTORY}/repositories/`.

> Note the **repository ID** in the _'Edit'_ and _'Delete'_ links - you will need this for the next step (webhook url)
Now use the `Edit` or `Delete` links to take note of the **Repository ID**. You will need this ID in the next step to configure the webhook URL.

### 3. Connecting GitHub to Redmine
### 4. Connect GitHub to Redmine

1. Go to the repository _Settings_ interface on GitHub.
2. Under _Webhooks_ add a new webHook:
1. Go to the Github repository's **Settings**
2. Select **Webhooks** and click `Add webhook`

- The _Payload URL_ needs to be of the format: `[redmine_url]/redmine_github/:repository_id/webhook` (for example `http://redmine.example.com/redmine_github/1/webhook`). Repository ID is the one of the **created in the previous step repository**
- _Content type_: **application/json**
- _Secret_: **same as Webhook Secret inside you Redmine repository settings**
- _Which events would you like to trigger this webhook?_ - _Pull requests, Pull request reviews, Pull request review comments, Pushes, Statuses, Commit comments_
- **Payload URL:** `[redmine_url]/redmine_github/:repository_id/webhook`
- *For example* `https://redmine.org/redmine_github/1/webhook`
- *Note: replace `:repository_id` with the **Repository ID** you noted in the previous step.*
- **Content type:** `application/json`
- **Secret:** `YOUR-WEBHOOK-SECRET`
- *Use the same **Webhook Secret** defined in previous step when configuring your Redmine project's Repository.*
- **Which events would you like to trigger this webhook?** `Let me select individual events`
- `Pull requests`
- `Pull request reviews`
- `Pull request review comments`
- `Pushes`
- `Statuses`
- `Commit comments`

### 4. Configure commit comments keywords
### 5. Configure commit comments keywords

In _(Administration|Settings)_ , _Repositories_ tab configure [commit comments keywords](https://www.redmine.org/projects/redmine/wiki/RedmineSettings#Referencing-issues-in-commit-messages).
Use the `Administration->Settings->Repositories` tab to configure [commit comments keywords](https://www.redmine.org/projects/redmine/wiki/RedmineSettings#Referencing-issues-in-commit-messages).

## Documentation

Read [redmine_github plugin wiki pages](https://github.com/agileware-jp/redmine_github/wiki) (still WIP).

## License

Copyright &copy; 2019 [Agileware Inc.](http://agileware.jp)
Copyright &copy; 2023 [Agileware Inc.](http://agileware.jp)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down