Files
moderne-docs/getting-started/running-your-first-recipe.md
2022-10-06 22:00:34 +00:00

5.3 KiB

Quick Start: Running your first recipe

To help orient you to Moderne, let's walk through how to run a recipe on some open source projects that we have imported into Moderne.

In this guide, we will:

Step 1: Go to public.moderne.io and log in

Moderne login button

Step 2: Sign in with GitHub

The first time you sign in to Moderne through GitHub, you will be presented with an authorization prompt for a few permissions to help enhance your experience.

{% hint style="info" %} For a better understanding of the permissions requested, please see GitHub Permissions. {% endhint %}

GitHub login permissions

GitHub permission request

Step 3: Navigate to the recipe catalog

After you've logged in and granted the appropriate permissions, you'll arrive at the Moderne home page. To explore the catalog of recipes, click on Catalog on the left side of the screen:

Moderne Home Page

Moderne home page

This will take you to a page that lists all of the recipe categories:

Moderne Catalog

Moderne recipe catalog

Step 4: Select a recipe

Let's find a good recipe to start from to help illustrate how to search across multiple repositories.

  1. From the Catalog page, click on Java from the list of categories.
  2. Select the Cleanup sub-category.
  3. Click on the Common static analysis issues recipe.

Step 5: Select specific repositories

By default, all of the repositories are selected. Let's change that so we only run our recipe on the OpenRewrite repositories.

  1. Click on the Select Repositories button.
  2. Click on the << arrows at the bottom to clear the selected repositories.
  3. Press the Add Filter button.
  4. Enter openrewrite in the text box.
  5. Press the >> arrows at the top to select all of the OpenRewrite repositories.
  6. You should now see all of the OpenRewrite repositories listed under Selected repositories.__
  7. Click anywhere outside of the filter box to confirm your selection.

Step 6: Run the recipe

Click Dry Run to start the recipe. You might be asked for additional GitHub permissions after you click this button.

On the results page, you will see a summary of your recipe criteria and an indication of progress.

Each result shows the number of files searched and how many changes were detected.

To see the proposed changes, click on either the button under Actions or the name of the repository (e.g. openrewrite/rewrite).

Step 7: View the results

The resulting diff allows you to preview the changes from the recipe before you decide what you want to do.

If you're unsure why something changed, you can click on the three dots (...) at the top right of any file and select Why did this change?

For instance, in the above example, = false was removed due to the Explicit initialization rule.

Step 8: Commit your changes

Once you've confirmed you want to make the changes, the next course of action is to commit everything.

In the results view, select the repositories you want to commit and then click Commit Selected.

This will open a prompt that allows you to select different actions such as committing directly, opening a pull request, etc.

From this prompt, you can customize either the Branch Name or the Commit Message to match the contributing guidelines of a particular repository.

{% hint style="info" %} You will need to have specific permissions depending on the commit strategy you decide to go with. {% endhint %}

Step 9: 🎉 Profit