Skip to content

Commit

Permalink
[Tooling] Setup Dangermattic (#113)
Browse files Browse the repository at this point in the history
* Setup Ruby

* Setup Danger

* Add Danger action to trigger Danger on Buildkite

* Update CHANGELOG

* Add review request events as Danger triggers

* Replace Unicode emojis

* Apply suggestions from code review

Co-authored-by: Gio Lodi <[email protected]>

* Revert "Replace Unicode emojis"

This reverts commit 8a3b874.

---------

Co-authored-by: Gio Lodi <[email protected]>
  • Loading branch information
iangmaia and mokagio authored Sep 10, 2024
1 parent 11f6d26 commit 4c31530
Show file tree
Hide file tree
Showing 8 changed files with 160 additions and 1 deletion.
10 changes: 10 additions & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ steps:
agents:
queue: default

- label: "☢️ Danger - PR Check"
command: danger
key: danger
if: build.pull_request.id != null
retry:
manual:
permit_on_passed: true
agents:
queue: linter

- group: ":swift: install_swiftpm_dependencies Tests"
steps:
- label: ":swift: Standalone Swift Package - Autodetect"
Expand Down
4 changes: 4 additions & 0 deletions .bundle/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
BUNDLE_PATH: "vendor/bundle"
BUNDLE_JOBS: "16"
BUNDLE_SPECIFIC_PLATFORM: "false"
17 changes: 17 additions & 0 deletions .github/workflows/run-danger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: ☢️ Trigger Danger On Buildkite

on:
pull_request:
types: [labeled, unlabeled, ready_for_review, review_requested, review_request_removed]

jobs:
dangermattic:
if: ${{ (github.event.pull_request.draft == false) }}
uses: Automattic/dangermattic/.github/workflows/[email protected]
with:
org-slug: automattic
pipeline-slug: ci-toolkit-buildkite-plugin
retry-step-key: danger
build-commit-sha: ${{ github.event.pull_request.head.sha }}
secrets:
buildkite-api-token: ${{ secrets.TRIGGER_BK_BUILD_TOKEN }}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@

.DS_Store

# IntelliJ
.idea/

# Bundler
vendor/
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ _None._

### Internal Changes

_None._
- Tooling change: Dangermattic setup [#113]

## 3.6.0

Expand Down
19 changes: 19 additions & 0 deletions Dangerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Check that the PR contains changes to the CHANGELOG.md file.
unless git.modified_files.include?('CHANGELOG.md')
warn('Please add an entry in the `CHANGELOG.md` file to describe the changes made by this PR')
end

pr_size_checker.check_diff_size(max_size: 500)

# skip remaining checks if the PR is still a Draft
if github.pr_draft?
message('This PR is still a Draft: some checks will be skipped.')
return
end

labels_checker.check(
do_not_merge_labels: ['do not merge'],
required_labels: []
)

warn("This PR has no reviewers. Please request a review from **@\u2060Automattic/apps-infrastructure**.") unless github_utils.requested_reviewers?
5 changes: 5 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# frozen_string_literal: true

source "https://rubygems.org"

gem 'danger-dangermattic', '~> 1.1'
99 changes: 99 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
GEM
remote: https://rubygems.org/
specs:
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
ast (2.4.2)
claide (1.1.0)
claide-plugins (0.9.2)
cork
nap
open4 (~> 1.3)
colored2 (3.1.2)
cork (0.3.0)
colored2 (~> 3.1)
danger (9.5.0)
claide (~> 1.0)
claide-plugins (>= 0.9.2)
colored2 (~> 3.1)
cork (~> 0.1)
faraday (>= 0.9.0, < 3.0)
faraday-http-cache (~> 2.0)
git (~> 1.13)
kramdown (~> 2.3)
kramdown-parser-gfm (~> 1.0)
octokit (>= 4.0)
terminal-table (>= 1, < 4)
danger-dangermattic (1.1.2)
danger (~> 9.4)
danger-plugin-api (~> 1.0)
danger-rubocop (~> 0.13)
rubocop (~> 1.63)
danger-plugin-api (1.0.0)
danger (> 2.0)
danger-rubocop (0.13.0)
danger
rubocop (~> 1.0)
faraday (2.11.0)
faraday-net_http (>= 2.0, < 3.4)
logger
faraday-http-cache (2.5.1)
faraday (>= 0.8)
faraday-net_http (3.3.0)
net-http
git (1.19.1)
addressable (~> 2.8)
rchardet (~> 1.8)
json (2.7.2)
kramdown (2.4.0)
rexml
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
language_server-protocol (3.17.0.3)
logger (1.6.1)
nap (1.1.0)
net-http (0.4.1)
uri
octokit (9.1.0)
faraday (>= 1, < 3)
sawyer (~> 0.9)
open4 (1.3.4)
parallel (1.26.3)
parser (3.3.5.0)
ast (~> 2.4.1)
racc
public_suffix (6.0.1)
racc (1.8.1)
rainbow (3.1.1)
rchardet (1.8.0)
regexp_parser (2.9.2)
rexml (3.3.7)
rubocop (1.66.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.4, < 3.0)
rubocop-ast (>= 1.32.2, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.32.3)
parser (>= 3.3.1.0)
ruby-progressbar (1.13.0)
sawyer (0.9.2)
addressable (>= 2.3.5)
faraday (>= 0.17.3, < 3)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
unicode-display_width (2.5.0)
uri (0.13.1)

PLATFORMS
arm64-darwin-23

DEPENDENCIES
danger-dangermattic (~> 1.1)

BUNDLED WITH
2.4.22

0 comments on commit 4c31530

Please sign in to comment.