openrewrite / openrewrite/rewrite-github-actions

Recipe - Extract reusable workflow

Open
#76 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

recipe
Dominant language
Java
Stars
1
Forks
9
Avg merge
5h 27m
Merged PRs (30d)
12

Description

Given a set of similar workflows such as those found at https://github.com/asyncer-io/r2dbc-mysql/tree/f4ca1652219074c337d7db12d2572686da2c3a64/.github/workflows where 3 workflows are almost identical except for 1 property

  • mysql5-5.yml
  • mysql5-6.yml
  • mysql5-7.yml
name: MySQL 5.7

on: [ pull_request ]

jobs:
  build:
    runs-on: ubuntu-20.04
    steps:
      - uses: actions/checkout@v3
      - name: Set up Temurin 8
        uses: actions/setup-java@v3
        with:
          distribution: temurin
          java-version: 8
          cache: maven
      - name: Shutdown the Default MySQL
        run: sudo service mysql stop
      - name: Set up MySQL 5.7
        uses: asyncer-io/mysql-action@trunk
        with:
          # THIS IS THE SINGLE VALUE THAT'S DIFFERENT
          mysql version: 5.7
          mysql database: r2dbc
          mysql root password: r2dbc-password!@
      - name: Integration test with MySQL 5.7
        run: ./mvnw -B verify -Dmaven.javadoc.skip=true -Dmaven.surefire.skip=true -Dtest.mysql.password=r2dbc-password!@ -Dtest.mysql.version=5.7 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing .github/workflows/mysql5-5.yml, mysql5-6.yml, and mysql5-7.yml at the referenced revision, focusing on their shared steps and differing MySQL version value. Review the repository's existing recipe structure before deciding how the extraction should be represented; done means the repeated workflows can share one reusable workflow while preserving their version-specific behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions
Domain
ci-cd
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.