Skip to content

Commit

Permalink
Add Danger
Browse files Browse the repository at this point in the history
First pass at using Danger to add PR comments when awesomebot finds bad
links.

Signed-off-by: Joe Block <[email protected]>
  • Loading branch information
unixorn committed Nov 12, 2023
1 parent fb70af3 commit fb0466e
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/danger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Danger Checks

on:
pull_request:
branches:
- main

jobs:
danger:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' # if only run pull request when multiple trigger workflow
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: '2.6'
- uses: actions/cache@v3
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('Gemfile') }} # change your gemfile path
restore-keys: |
${{ runner.os }}-gems-
- 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 }}
8 changes: 8 additions & 0 deletions Dangerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Check links
require 'json'
results = File.read 'ab-results-README.md-markdown-table.json'
j = JSON.parse results
if j['error']==true
fail j['title']
markdown j['message']
end

0 comments on commit fb0466e

Please sign in to comment.