openrewrite / rewrite-github-actions

OpenRewrite recipes for performing GitHub action hygiene and migration tasks.
Apache License 2.0
9 stars 9 forks source link

Change Maven commands to use the maven wrapper #57

Open yeikel opened 1 year ago

yeikel commented 1 year ago

This recipe can be part of https://github.com/openrewrite/rewrite/issues/1565 and change all the maven references to the maven wrapper

Example:

name: Java CI

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Build with Maven
        run: mvn --batch-mode --update-snapshots package

Unix runners:

name: Java CI

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Build with Maven
        run: ./mvn --batch-mode --update-snapshots package

Windows Runners:

 name: Java CI

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Build with Maven
        run: mvn.cmd --batch-mode --update-snapshots package
yeikel commented 1 year ago

@timtebeek We can create a separate recipe(should it be the same?) for Gradle

timtebeek commented 1 year ago

Probably best to create a separate recipe!

yeikel commented 1 year ago

Probably best to create a separate recipe!

That's fair, I created https://github.com/openrewrite/rewrite-github-actions/issues/58

I am expecting a lot of code re-use here

You can assign both to me :)

yeikel commented 1 year ago

Also, how do you think we should detect Windows vs Linux runners?

Few ideas:

timtebeek commented 1 year ago

I'd go with that second heuristic indeed; and likely not make any change if we can't be certain which is in use. That way we can support the most common use cases already, and people that need more can chime in again.

yeikel commented 1 year ago

Also, how do you think we should detect Windows vs Linux runners?

Few ideas:

For an initial implementation, I would definitely like to support private runners(with user input) as well because this is the norm in Github Enterprise

I am open to implement private runners(GHE) and the public runners approach for the general github.com usage

yeikel commented 1 year ago

@timtebeek Should we do this https://github.com/openrewrite/rewrite/issues/1565#issuecomment-1458562516

As part of this recipe just in case?

timtebeek commented 1 year ago

Can't hurt I suppose; as indeed, if that's not working the recipe will give bad results, loudly.

timtebeek commented 1 year ago

Hope you don't mind I unassigned you @yeikel I want to open this issue back up again to anyone to pick up. Feel free to open up a draft pull request if you'd like to contribute!