Skip to content

Commit

Permalink
Add Danger-bot
Browse files Browse the repository at this point in the history
Signed-off-by: Tom Siewert <[email protected]>
  • Loading branch information
sinuscosinustan committed Jan 30, 2023
1 parent 355c37e commit 44f7461
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/danger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
name: Dangerbot
on:
pull_request:
branches:
- main

jobs:
danger:
name: Danger
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Ruby 3.0
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'

- name: Configure cache
uses: actions/cache@v1
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('Gemfile') }}
restore-keys: |
${{ runner.os }}-gems-
- 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 }}
12 changes: 12 additions & 0 deletions Dangerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# -*- mode: ruby -*- vim: set syntax=ruby
# frozen_string_literal: true

if git.commits.any? { |c| c.message =~ /^Merge branch/ }
fail('Please rebase to get rid of the merge commits in this PR!')
message "For more information, please see [man git-rebase](https://git-scm.com/docs/git-rebase)."
end

if !git.modified_files.include?("CHANGELOG.md") && !has_app_changes
fail("Please include a CHANGELOG entry. \nYou can find it at [CHANGELOG.md](https://github.com/hetznercloud/ansible-ipxe-ca/blob/main/CHANGELOG.md).")
message "Note, we use [changelogger](https://github.com/MarkusFreitag/changelogger) as changelog tooling."
end
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'

0 comments on commit 44f7461

Please sign in to comment.