Skip to content

Commit

Permalink
Count number of PRs open in CD-enabled apps before deciding string
Browse files Browse the repository at this point in the history
It's quite possible that there are CD-enabled apps managed by the
given team, but that there are no PRs open for them. Currently, it
will say:

```
[TEAM_NAME] have 0 Dependabot PRs open on the following
Continuously Deployed apps:

And 73 Dependabot PRs open on other apps:
```

Screenshot:

![](https://user-images.githubusercontent.com/5111927/107197652-10346680-69ec-11eb-926d-64b8f02f74a5.png)

This commit now counts the number of PRs in those apps before
deciding whether to show the CD part of the string.
  • Loading branch information
ChrisBAshton committed Feb 8, 2021
1 parent 3604712 commit a2eda3d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/presenters/slack/full_message.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ module Slack
class FullMessage
def execute(applications_by_team:, continuously_deployed_apps: [])
applications = applications_by_team.fetch(:applications)
if continuously_deployed_apps.any?
cd_apps = applications.filter { |app| continuously_deployed_apps.include?(app.fetch(:application_name)) }
cd_apps = applications.filter { |app| continuously_deployed_apps.include?(app.fetch(:application_name)) }
if pull_requests_count(cd_apps).positive?
"#{url_for_team(applications_by_team)} have #{pull_requests_count(cd_apps)} Dependabot PRs open on the following Continuously Deployed apps:
#{body(cd_apps).join(' ')}
Expand Down

0 comments on commit a2eda3d

Please sign in to comment.