Skip to content
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

Danger #1

Merged
merged 4 commits into from
Sep 3, 2021
Merged
Show file tree
Hide file tree
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
28 changes: 28 additions & 0 deletions rails-bootstrap/.github/auto_assign.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Set to true to add reviewers to pull requests
addReviewers: true

# Set to true to add assignees to pull requests
addAssignees: false

# A list of team reviewers to be added to pull requests (GitHub team slug)
reviewers:
- org/teamReviewerA
- org/teamReviewerB
- /teamReviewerC

# Number of reviewers has no impact on Github teams
# Set 0 to add all the reviewers (default: 0)
numberOfReviewers: 0

# A list of assignees, overrides reviewers if set
# assignees:
# - assigneeA

# A number of assignees to add to the pull request
# Set to 0 to add all of the assignees.
# Uses numberOfReviewers if unset.
# numberOfAssignees: 2

# A list of keywords to be skipped the process that add reviewers if pull requests include it
# skipKeywords:
# - wip
44 changes: 44 additions & 0 deletions rails-bootstrap/.github/workflows/danger-action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Danger

on:
# Triggers the workflow on push or pull request events but only for the master branch
pull_request:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' # if only run pull request when multiple trigger workflow
steps:
- uses: actions/checkout@v2
- name: Set up ruby
uses: actions/setup-ruby@v1
with:
ruby-version: '3.0.2'
- uses: actions/cache@v1
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('Gemfile') }} # change your gemfile path
restore-keys: |
${{ runner.os }}-gems-
- name: Run Auto assign
uses: kentaro-m/[email protected]
with:
repo-token: ${{ secrets.GITHUB_TOKEN }} # sets in repo settings/secrets
configuration-path: .github/auto_assign.yml
- name: Run brakeman with reviewdog
uses: reviewdog/action-brakeman@v1
with:
brakeman_flags: --color
github_token: ${{ secrets.github_token }}
reporter: github-pr-review # Default is github-pr-check
- name: Run Danger
uses: MeilCli/danger-action@v5
with:
plugins_file: 'Gemfile'
install_path: 'vendor/bundle'
danger_file: 'Dangerfile'
danger_id: 'danger-pr'
env:
DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} # sets in repo settings/secrets
44 changes: 44 additions & 0 deletions rails-bootstrap/Dangerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Sometimes it's a README fix, or something like that - which isn't relevant for
# including in a project's CHANGELOG for example
declared_trivial = github.pr_title.include? "#trivial"

# Make it more obvious that a PR is a work in progress and shouldn't be merged yet
warn("PR is classed as Work in Progress") if github.pr_title.include? "[WIP]"

# Warn when there is a big PR
warn("Big PR") if git.lines_of_code > 500

# Don't let testing shortcuts get into master by accident
fail("fdescribe left in tests") if `grep -r fdescribe spec/ `.length > 1
fail("fit left in tests") if `grep -r fit spec/ `.length > 1

# Ensure that labels have been used on the PR
failure "Please add labels to this PR" if github.pr_labels.empty?

# Ensure there is a summary for a PR
failure "Please provide a summary in the Pull Request description" if github.pr_body.length < 5

# Note when a PR cannot be manually merged, which goes away when you can
can_merge = github.pr_json["mergeable"]
warn("This PR cannot be merged yet.", sticky: false) unless can_merge

# Ensure that body of PR is not empty
failure "Please add text to PR body" if github.pr_body.empty?

# Changelog check
changelog.check!

# Commit lint check
commit_lint.check

# Runs rails_best_practices on modified and added files in the PR
rails_best_practices.lint

# Suggest code changes through inline comments in pull requests.
suggester.suggest

# README.md has a TOC
toc.check!

# Runs danger-rubocop linter
rubocop.lint
8 changes: 8 additions & 0 deletions rails-bootstrap/Gemfile.tt
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,14 @@ group :development do
gem "brakeman", require: false
gem "bundler-audit", ">= 0.9.0"
gem "derailed_benchmarks"
gem "danger"
gem "danger-brakeman_scanner"
gem "danger-changelog", "~> 0.6.1"
gem "danger-commit_lint"
gem "danger-rails_best_practices", "~> 0.1.3"
gem "danger-suggester"
gem "danger-toc", "~> 0.2.0"
gem "danger-rubocop"
gem "erb_lint"
gem "fasterer"
gem "pry-rails"
Expand Down
28 changes: 28 additions & 0 deletions rails-tailwind/.github/auto_assign.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Set to true to add reviewers to pull requests
addReviewers: true

# Set to true to add assignees to pull requests
addAssignees: false

# A list of team reviewers to be added to pull requests (GitHub team slug)
reviewers:
- org/teamReviewerA
- org/teamReviewerB
- /teamReviewerC

# Number of reviewers has no impact on Github teams
# Set 0 to add all the reviewers (default: 0)
numberOfReviewers: 0

# A list of assignees, overrides reviewers if set
# assignees:
# - assigneeA

# A number of assignees to add to the pull request
# Set to 0 to add all of the assignees.
# Uses numberOfReviewers if unset.
# numberOfAssignees: 2

# A list of keywords to be skipped the process that add reviewers if pull requests include it
# skipKeywords:
# - wip
44 changes: 44 additions & 0 deletions rails-tailwind/.github/workflows/danger-action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Danger

on:
# Triggers the workflow on push or pull request events but only for the master branch
pull_request:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' # if only run pull request when multiple trigger workflow
steps:
- uses: actions/checkout@v2
- name: Set up ruby
uses: actions/setup-ruby@v1
with:
ruby-version: '3.0.2'
- uses: actions/cache@v1
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('Gemfile') }} # change your gemfile path
restore-keys: |
${{ runner.os }}-gems-
- name: Run Auto assign
uses: kentaro-m/[email protected]
with:
repo-token: ${{ secrets.GITHUB_TOKEN }} # sets in repo settings/secrets
configuration-path: .github/auto_assign.yml
- name: Run brakeman with reviewdog
uses: reviewdog/action-brakeman@v1
with:
brakeman_flags: --color
github_token: ${{ secrets.github_token }}
reporter: github-pr-review # Default is github-pr-check
- name: Run Danger
uses: MeilCli/danger-action@v5
with:
plugins_file: 'Gemfile'
install_path: 'vendor/bundle'
danger_file: 'Dangerfile'
danger_id: 'danger-pr'
env:
DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} # sets in repo settings/secrets
44 changes: 44 additions & 0 deletions rails-tailwind/Dangerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Sometimes it's a README fix, or something like that - which isn't relevant for
# including in a project's CHANGELOG for example
declared_trivial = github.pr_title.include? "#trivial"

# Make it more obvious that a PR is a work in progress and shouldn't be merged yet
warn("PR is classed as Work in Progress") if github.pr_title.include? "[WIP]"

# Warn when there is a big PR
warn("Big PR") if git.lines_of_code > 500

# Don't let testing shortcuts get into master by accident
fail("fdescribe left in tests") if `grep -r fdescribe spec/ `.length > 1
fail("fit left in tests") if `grep -r fit spec/ `.length > 1

# Ensure that labels have been used on the PR
failure "Please add labels to this PR" if github.pr_labels.empty?

# Ensure there is a summary for a PR
failure "Please provide a summary in the Pull Request description" if github.pr_body.length < 5

# Note when a PR cannot be manually merged, which goes away when you can
can_merge = github.pr_json["mergeable"]
warn("This PR cannot be merged yet.", sticky: false) unless can_merge

# Ensure that body of PR is not empty
failure "Please add text to PR body" if github.pr_body.empty?

# Changelog check
changelog.check!

# Commit lint check
commit_lint.check

# Runs rails_best_practices on modified and added files in the PR
rails_best_practices.lint

# Suggest code changes through inline comments in pull requests.
suggester.suggest

# README.md has a TOC
toc.check!

# Runs danger-rubocop linter
rubocop.lint
10 changes: 9 additions & 1 deletion rails-tailwind/Gemfile.tt
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ group :development, :test do
gem "rubocop-performance"
gem "rubocop-rails"
gem "rubocop-rspec"
gem "simplecov", require: false
gem "simplecov", require: false

gem "capybara"
gem "cucumber-rails", require: false
Expand All @@ -103,6 +103,14 @@ group :development do
gem "brakeman", require: false
gem "bundler-audit", ">= 0.9.0"
gem "derailed_benchmarks"
gem "danger"
gem "danger-brakeman_scanner"
gem "danger-changelog", "~> 0.6.1"
gem "danger-commit_lint"
gem "danger-rails_best_practices", "~> 0.1.3"
gem "danger-suggester"
gem "danger-toc", "~> 0.2.0"
gem "danger-rubocop"
gem "erb_lint"
gem "fasterer"
gem "pry-rails"
Expand Down