Skip to content

Commit

Permalink
Add Dangerfile
Browse files Browse the repository at this point in the history
Warns that a PR involves migrations and pings Markus.
  • Loading branch information
aaron-contreras authored and oliverguenther committed Feb 22, 2024
1 parent eb0a22b commit 6827196
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/danger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: migration-warning-on-release-branches

on:
pull_request:
branches:
- release/*
paths:
- 'db/migrate/**.rb'
- 'modules/**/db/migrate/*.rb'

jobs:
danger:
if: github.repository == 'opf/openproject'
runs-on: [ubuntu-latest]
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2.3'
- uses: MeilCli/danger-action@v5
with:
danger_file: 'Dangerfile'
danger_id: 'danger-pr'
env:
DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9 changes: 9 additions & 0 deletions Dangerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CORE_OR_MODULE_MIGRATIONS_REGEX = %r{(modules/.*)?db/migrate/.*\.rb}

def added_or_modified_migrations?
(git.modified_files + git.added_files).grep(CORE_OR_MODULE_MIGRATIONS_REGEX)
end

if added_or_modified_migrations?
warn "This PR has migration-related changes on a release branch. Ping @opf/operations"
end

0 comments on commit 6827196

Please sign in to comment.