Skip to content

Commit 05e7678

Browse files
committed
Tweaks to prevent unnecessary checks running while a PR is a Draft
1 parent c77bba1 commit 05e7678

2 files changed

Lines changed: 12 additions & 9 deletions

File tree

.github/workflows/run-danger.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ name: ☢️ Danger
22

33
on:
44
pull_request:
5-
types: [opened, synchronize, edited, review_requested, review_request_removed, labeled, unlabeled, milestoned, demilestoned]
5+
types: [opened, reopened, ready_for_review, synchronize, edited, labeled, unlabeled, milestoned, demilestoned]
66

77
jobs:
88
dangermattic:
9+
# runs on draft PRs only for opened / synchronize events
10+
if: ${{ (github.event.pull_request.draft == false) || (github.event.pull_request.draft == true && contains(fromJSON('["opened", "synchronize"]'), github.event.action)) }}
911
uses: Automattic/dangermattic/.github/workflows/reusable-run-danger.yml@v1.0.0
1012
secrets:
1113
github-token: ${{ secrets.DANGERMATTIC_GITHUB_TOKEN }}

Dangerfile

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,18 @@ common_release_checker.check_internal_release_notes_changed(report_type: :messag
2222

2323
ios_release_checker.check_modified_translations_on_release_branch
2424

25+
view_changes_checker.check
26+
27+
pr_size_checker.check_diff_size(max_size: 500)
28+
29+
# skip remaining checks if we have a Draft PR
30+
return if github.pr_draft?
31+
2532
labels_checker.check(
2633
do_not_merge_labels: ['[Status] DO NOT MERGE'],
2734
required_labels: [//],
2835
required_labels_error: 'PR requires at least one label.'
2936
)
3037

31-
view_changes_checker.check
32-
33-
pr_size_checker.check_diff_size(max_size: 500)
34-
35-
# skip check for draft PRs and for WIP features unless the PR is against the main branch or release branch
36-
unless github.pr_draft? || (github_utils.wip_feature? && !(github_utils.release_branch? || github_utils.main_branch?))
37-
milestone_checker.check_milestone_due_date(days_before_due: 4)
38-
end
38+
# skip check for WIP features unless the PR is against the main branch or release branch
39+
milestone_checker.check_milestone_due_date(days_before_due: 4) unless github_utils.wip_feature? && !(github_utils.release_branch? || github_utils.main_branch?)

0 commit comments

Comments
 (0)