Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure Danger, enforce labels #1761

Conversation

vegaro
Copy link
Contributor

@vegaro vegaro commented Jul 13, 2022

  • Adds Danger
  • Adds a check for PR labels

This is how the check looks like:

Screen Shot 2022-08-05 at 9 01 39 AM

This PR initially added Jira link checks, but the lack of customization on the danger-jira plugin made me decide to drop the danger check. We should probably write our own/fork that plugin and add more options.

CSDK-127

@vegaro vegaro changed the title Configure Danger [WIP] Configure Danger Jul 13, 2022
@vegaro vegaro changed the title [WIP] Configure Danger #trivial Configure Danger Jul 13, 2022
@vegaro vegaro changed the title #trivial Configure Danger Configure Danger [no-changelog] Jul 19, 2022
@vegaro vegaro changed the title Configure Danger [no-changelog] Configure Danger [no-changelog] [CSDK-127] Jul 19, 2022
@vegaro vegaro changed the title Configure Danger [no-changelog] [CSDK-127] Configure Danger Jul 19, 2022
@vegaro vegaro changed the title Configure Danger Configure Danger [no-changelog] Jul 19, 2022
@vegaro vegaro changed the title Configure Danger [no-changelog] Configure Danger Jul 19, 2022
@vegaro vegaro changed the title Configure Danger Configure Danger [no-changelog] Jul 19, 2022
@vegaro vegaro changed the title Configure Danger [no-changelog] Configure Danger Jul 19, 2022
@vegaro vegaro changed the title Configure Danger Configure Danger [no-changelog] Jul 19, 2022
@vegaro
Copy link
Contributor Author

vegaro commented Jul 20, 2022

That's great feedback @NachoSoto and I agree with you.

I think the Danger plugin also checks if the description of the PR has the jira ticket, let me confirm. Do you think that would be better?

@vegaro
Copy link
Contributor Author

vegaro commented Jul 20, 2022

ok so I retested it @NachoSoto and it looks like it also looks for the JIRA issue in the PR body and the PR title. I think having it in the body is good right? If we have external contributors we can edit the PR body or the PR title ourselves too.

What do you think?

@NachoSoto
Copy link
Contributor

ok so I retested it @NachoSoto and it looks like it also looks for the JIRA issue in the PR body and the PR title. I think having it in the body is good right? If we have external contributors we can edit the PR body or the PR title ourselves too.

What do you think?

That would be great!

@vegaro vegaro changed the title Configure Danger [no-changelog] Configure Danger Jul 21, 2022
@vegaro
Copy link
Contributor Author

vegaro commented Jul 21, 2022

I removed the changelog check stuff because we want to automate it in and not require it in the PRs :)

Dangerfile Outdated
search_commits: false,
fail_on_warning: false,
report_missing: true,
skippable: true # skippable by adding [no-jira] to PR title or body
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧡 like the skippable, but maybe also enforce a skip reason? Like if you use the [no-jira] we should have a description that makes it obvious why we skipped? like require skip jira reason:
Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it. The thing is that this is a plugin and it doesn't have the option. I would also like to change the warning message. Maybe I fork it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it looks abandoned 😿 I think your best bet is a fork. I looked at the other forks, and nothing sticks out as one we should use.

Copy link
Contributor Author

@vegaro vegaro Jul 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes... the goal of this sprint is to work on release trains so I might merge it like this and work on the fork in the future. We are going to still use Danger for the release trains (to check if PRs are label correctly) so this PR is still useful.

Do you think we can still use this plugin until we fork it? Or should we just not use it at all

@vegaro vegaro added build and removed build labels Jul 22, 2022
@vegaro vegaro changed the title Configure Danger Configure Danger, enforce labels and JIRA links Jul 22, 2022
…s-set-up-danger-to-ensure-changelog-updates-on-every-pr

# Conflicts:
#	Gemfile.lock
@vegaro
Copy link
Contributor Author

vegaro commented Aug 5, 2022

I removed the danger-jira stuff since we would like to do some stuff the plugin doesn't support:

  • Make it optional
  • Change the error message

I think it's better to leave it for another sprint and focus on releases this sprint

@vegaro
Copy link
Contributor Author

vegaro commented Aug 5, 2022

I created a new bot RevenueCat-Danger-Bot because it is recommended in https://danger.systems/guides/getting_started.html#oss-projects that the bots don't have access to the repositories and RCGitBot has access.

I am not sure what the security concern is. I guess the problem is that the token could be leaked in CI. But in that case the RCGitBot token we have right now can also be leaked right?

@vegaro vegaro changed the title Configure Danger, enforce labels and JIRA links Configure Danger, enforce labels Aug 5, 2022
@vegaro vegaro added the ci label Aug 5, 2022
@vegaro vegaro requested a review from a team August 5, 2022 07:12
Copy link
Contributor

@tonidero tonidero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly a question and a comment but looking good.

Dangerfile Outdated
no_supported_label = supported_labels_in_pr.empty?
if no_supported_label
fail("Label the PR using one of the change type labels: #{supported_types}")
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't used Danger before so I don't know but just wondering if this could be introduced in a function and then call that function, in case we add other validations in the future.

@@ -534,3 +554,6 @@ workflows:
- docs-deploy:
xcode_version: '14.0.0'
<<: *release-tags
danger:
jobs:
- danger
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to specify in what branches we need to run this? I guess we want every branch that has a PR associated? (Though not sure how to do that in circleci)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the settings we have in CircleCI for purchases-ios it will work like that and this will run in every branch with a PR

Screen Shot 2022-08-05 at 2 02 35 PM

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh interesting... I don't think that's the case for all our repos, which might lead to inconsistencies. But it should be ok in this repo then 👍

@vegaro vegaro merged commit 496b5bd into main Aug 5, 2022
@vegaro vegaro deleted the CSDK-127-purchases-ios-set-up-danger-to-ensure-changelog-updates-on-every-pr branch August 5, 2022 15:28
This was referenced Aug 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants