-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: implement PR to linear issues linker
- Loading branch information
Showing
11 changed files
with
2,510 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
### Overview | ||
|
||
This is a github action to link a GitHub PR to Linear issues, because Linear doesn't do that automatically. It supports all the GitHub magic words (closes, fixes, etc.) so that when a PR closes an issue via magic words, the action finds the Linear issues related to the closing issues and links them by adding a comment in the PR's body with Linear magic words that close that Linear issue: | ||
|
||
```md | ||
<!-- LINEAR: closes LIN-ID-1, LIN-ID-2 --> | ||
|
||
- Closes #ISSUE1, | ||
- Closes #ISSUE2 | ||
``` | ||
|
||
If one wants to relate a PR to an issue without setting it as closing for that issue, they can add a "relates to", "related to", or "part of". | ||
This adds a markdown comment which relates the PR to linear issues without tagging the PR as closing in Linear: | ||
|
||
```md | ||
<!-- LINEAR: relates to LIN-ID-1, LIN-ID-2, LIN-ID-3 --> | ||
|
||
- Relates to #ISSUE1 | ||
- Related to #ISSUE2 | ||
- Part of #ISSUE3 | ||
``` | ||
|
||
Besides linking issues, the action also unlinks issues from PRs for cases where somebody erroneously links the wrong issue in GitHub (e.g. wanted to close #ISSUE2 but wrote that it closes #ISSUE1 and then they edit it to the correct issue). This isn't automatically handled by Linear when the related Linear issue's identifier is removed from the body of the PR. | ||
|
||
### How to use? | ||
|
||
```yml | ||
- uses: FuelLabs/github-actions/linear/link-pr-to-linear-issue@master | ||
with: | ||
repository: ${{ github.repository }} # You can omit it | ||
pull_number: ${{ github.event.client_payload.ref }} | ||
linear_api_key: ${{ secrets.LINEAR_TOKEN }} | ||
github_token: ${{ secrets.REPO_TOKEN }} | ||
``` | ||
### Inputs | ||
| Name | Description | Default | | ||
| -------------- | ---------------------------------------------------------- | -------------------------- | | ||
| repository | Github Repository | `${{ github.repository }}` | | ||
| pull_number | The PR number who's body will be read and updated | | | ||
| linear_api_key | Linear API key to use | | | ||
| github_token | A token with write permissions for updating the PR body | | | ||
|
||
|
||
## License | ||
|
||
The primary license for this repo is `Apache 2.0`, see [`LICENSE`](../LICENSE.md). |
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,21 @@ | ||
name: "Link PR to Linear Issues" | ||
description: "Workflow for linking PRs to Linear issues" | ||
|
||
inputs: | ||
repository: | ||
description: "Github Repository" | ||
default: ${{ github.repository }} | ||
pull_number: | ||
description: "PR number to link to linear issues" | ||
default: ${{ github.event.client_payload.ref }} | ||
required: true | ||
linear_api_key: | ||
description: "Linear API key" | ||
required: true | ||
github_token: | ||
description: "Github token" | ||
required: true | ||
|
||
runs: | ||
using: "node20" | ||
main: "dist/index.js" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,25 @@ | ||
{ | ||
"name": "link-pr-to-linear-issue", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "./src/index.ts", | ||
"scripts": { | ||
"test": "vitest run --config vitest.config.ts", | ||
"prebuild": "pnpm test", | ||
"build": "tsup" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"@actions/core": "^1.10.1", | ||
"@actions/github": "^6.0.0", | ||
"@linear/sdk": "^30.0.0" | ||
}, | ||
"devDependencies": { | ||
"@fuels/ts-config": "^0.20.0", | ||
"@types/node": "^22.6.1", | ||
"tsup": "^8.3.0", | ||
"vitest": "^2.1.1" | ||
} | ||
} |
Oops, something went wrong.