forked from zed-industries/zed
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR sets up [Danger](https://danger.systems/js/) to help us codify some of our PR rules. As an initial rule, Danger will check to ensure that every PR has a `Release Notes` section: <img width="943" alt="Screenshot 2024-01-29 at 11 50 12 AM" src="https://github.com/zed-industries/zed/assets/1486634/4d56e759-e72f-4bc0-8e74-42c55e2e6888"> Release Notes: - N/A
- Loading branch information
1 parent
d694017
commit d60ef81
Showing
5 changed files
with
1,135 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,35 @@ | ||
name: Danger | ||
|
||
on: | ||
pull_request: | ||
branches: [main] | ||
types: | ||
- opened | ||
- synchronize | ||
- reopened | ||
- edited | ||
|
||
jobs: | ||
danger: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: pnpm/action-setup@v2.2.4 | ||
with: | ||
version: 8 | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "20" | ||
cache: "pnpm" | ||
cache-dependency-path: "script/danger/pnpm-lock.yaml" | ||
|
||
- run: pnpm install --dir script/danger | ||
|
||
- name: Run Danger | ||
run: pnpm run --dir script/danger danger ci | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} |
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 @@ | ||
node_modules/ |
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,27 @@ | ||
import { danger, warn } from "danger"; | ||
|
||
const RELEASE_NOTES_PATTERN = new RegExp("Release Notes:\\r?\\n\\s+-", "gm"); | ||
|
||
const hasReleaseNotes = RELEASE_NOTES_PATTERN.test(danger.github.pr.body); | ||
if (!hasReleaseNotes) { | ||
warn( | ||
[ | ||
"This PR is missing release notes.", | ||
"", | ||
'Please add a "Release Notes" section that describes the change:', | ||
"", | ||
"```", | ||
"Release Notes:", | ||
"", | ||
"- (Added|Fixed|Improved) ... ([#<public_issue_number_if_exists>](https://github.com/zed-industries/zed/issues/<public_issue_number_if_exists>)).", | ||
"```", | ||
"", | ||
'If your change is not user-facing, you can use "N/A" for the entry:', | ||
"```", | ||
"Release Notes:", | ||
"", | ||
"- N/A", | ||
"```", | ||
].join("\n"), | ||
); | ||
} |
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,12 @@ | ||
{ | ||
"name": "danger", | ||
"version": "1.0.0", | ||
"private": true, | ||
"main": "index.js", | ||
"scripts": { | ||
"danger": "danger" | ||
}, | ||
"devDependencies": { | ||
"danger": "11.3.1" | ||
} | ||
} |
Oops, something went wrong.