Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Add Dangerfile

Aaron Contreras6827196e9e34
diff --git a/.github/workflows/danger.yml b/.github/workflows/danger.yml
new file mode 100644
index 00000000000..8b30f3873e4
--- /dev/null
+++ b/.github/workflows/danger.yml
@@ -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 }}
diff --git a/Dangerfile b/Dangerfile
new file mode 100644
index 00000000000..3e464b81f62
--- /dev/null
+++ b/Dangerfile
@@ -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