https://github.com/toshimaru/backlog-pr-link-action
Link GitHub Pull Request to Backlog issue.
https://github.com/toshimaru/backlog-pr-link-action
github-actions
Last synced: about 1 year ago
JSON representation
Link GitHub Pull Request to Backlog issue.
- Host: GitHub
- URL: https://github.com/toshimaru/backlog-pr-link-action
- Owner: toshimaru
- License: mit
- Created: 2020-08-22T23:00:25.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2025-05-04T00:52:55.000Z (about 1 year ago)
- Last Synced: 2025-05-04T01:21:10.870Z (about 1 year ago)
- Topics: github-actions
- Language: TypeScript
- Homepage: https://github.com/marketplace/actions/backlog-pull-request-link-action
- Size: 4.61 MB
- Stars: 5
- Watchers: 2
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/toshimaru/backlog-pr-link-action/actions/workflows/test.yml)
# backlog-pr-link-action
GitHub Actions: Link GitHub Pull Request to [Backlog](https://backlog.com/) issue.
## Prerequisite
- Backlog **Premium** plan (ref. [Backlog Pricing](https://backlog.com/pricing/))
- Create custom field named **"Pull Request"** in Backlog issue
## Usage
```yml
# .github/workflows/backlog-pr-link.yml
name: 'Link PR to Backlog'
on:
pull_request:
types: [opened, edited]
jobs:
backlog-pr-link:
runs-on: ubuntu-latest
steps:
- uses: toshimaru/backlog-pr-link-action@v2.1.1
with:
backlog-api-key: "${{ secrets.BACKLOG_API_KEY }}"
backlog-host: "your-org.backlog.com"
```
### Tips: Avoiding unnecessary runs
If the pull request doesn't contain a Backlog URL, no need to run this action.
To avoid this situation, you can skip the job by using `if` expression as follows:
```yml
# Run the job only when the pull request contains a Backlog URL
jobs:
backlog-pr-link:
runs-on: ubuntu-latest
if: contains(github.event.pull_request.body, 'https://yourhost.backlog.com/')
steps:
- ...
```
## How it works
- Check the pull request has a Backlog issue URL when it's opened or edited
- If it has the URL, link GitHub PR to Backlog issue
## Setup
### 1. Create a custom field named `Pull Request`
- Custom Field: `Pull Request`
- Custom Field Type: `Sentence`
Image: Create a custom field

#### Reference
- [English] [Setting Custom fields - Backlog Enterprise](https://backlog.com/enterprise-help/usersguide/custom-field/userguide1099/)
- [Japanese] [カスタム属性の設定方法 – Backlog ヘルプセンター](https://support-ja.backlog.com/hc/ja/articles/360035640274-%E3%82%AB%E3%82%B9%E3%82%BF%E3%83%A0%E5%B1%9E%E6%80%A7%E3%81%AE%E8%A8%AD%E5%AE%9A%E6%96%B9%E6%B3%95)
### 2. Generate Backlog API key
- Go to Backlog API Settings page
- Generate API key for the action
Image: Generate Backlog API key

#### Reference
- [English] [API Settings – Backlog Help Center](https://support.backlog.com/hc/en-us/articles/115015420567-API-Settings)
- [Japanese] [APIの設定 – Backlog ヘルプセンター](https://support-ja.backlog.com/hc/ja/articles/360035641754)
### 3. Set API key to GitHub Secret
- Go to GitHub Actions secrets page
- Add GitHub Repository secret
- secret name: `BACKLOG_API_KEY`
- secret value: {your-backlog-api-key}
Image: Set API key to GitHub Secret

#### Reference
- [Encrypted secrets - GitHub Docs](https://docs.github.com/en/actions/reference/encrypted-secrets)