-
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.
- Loading branch information
1 parent
58555a1
commit 700e7b2
Showing
2 changed files
with
48 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,22 @@ | ||
name: Danger | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- '*' | ||
|
||
jobs: | ||
danger: | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'pull_request' | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: '2.6' | ||
- uses: MeilCli/danger-action@v6 | ||
with: | ||
danger_file: 'Dangerfile' | ||
danger_id: 'danger-pr' | ||
env: | ||
DANGER_GITHUB_API_TOKEN: ${{ secrets.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,26 @@ | ||
# Ensure commit_subjection matches the following format | ||
# | ||
# fix(api): Caught Promise exception | ||
# feat(panel): Added new files | ||
# chore(docs): Updated dependencies | ||
# refactor(api): Updated code to use new API | ||
# test(api): Added new tests | ||
# docs(monitoring): Updated documentation | ||
# style(panel): Fixed linting issues | ||
# perf(monitoring): Improved performance | ||
allowed_types = %w(fix feat chore refactor test docs style perf) | ||
|
||
git.commits.each do |commit| | ||
commit_subject = commit.message.split("\n").first | ||
|
||
if commit_subject.match?(/\.$/) | ||
failure "The commit message \"#{commit_subject}\" does have a dot at the end. Please remove it" | ||
end | ||
|
||
unless commit_subject.match?(/^(fix|feat|chore|refactor|test|docs|style|perf)\([a-z0-9\-]+\): .+/) | ||
failure "The commit subject \"#{commit_subject}\" does not match our guidelines. Example \"chore(api): Upgraded dependencies\", allowed types are #{allowed_types.join(", ")}" | ||
end | ||
end | ||
|
||
|
||
|