Skip to content

Commit

Permalink
Align ChangeActionVersion constructor with other recipes
Browse files Browse the repository at this point in the history
  • Loading branch information
timtebeek committed Dec 5, 2023
1 parent 0864950 commit 4bbcf55
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/main/java/org/openrewrite/github/ChangeActionVersion.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,23 @@
*/
package org.openrewrite.github;

import lombok.RequiredArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Value;
import org.openrewrite.*;
import org.openrewrite.yaml.ChangeValue;

@RequiredArgsConstructor
@Value
@EqualsAndHashCode(callSuper = true)
public class ChangeActionVersion extends Recipe {
@Option(displayName = "Action",
description = "Name of the action to update.",
example = "actions/setup-java")
private final String action;
String action;

@Option(displayName = "Version",
description = "Version to use.",
example = "v4")
private final String version;
String version;

@Override
public String getDisplayName() {
Expand Down
36 changes: 36 additions & 0 deletions src/test/java/org/openrewrite/github/ChangeActionVersionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,40 @@ void updateActionVersion() {
)
);
}

@Test
void updateActionVersionYaml() {
rewriteRun(
spec -> spec.recipeFromYaml("""
type: specs.openrewrite.org/v1beta/recipe
name: org.example.SetupJavaV4
displayName: Exammple
description: Fix all the things.
recipeList:
- org.openrewrite.github.ChangeActionVersion:
action: actions/setup-java
version: v4
""", "org.example.SetupJavaV4"),
//language=yaml
yaml(
"""
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@main
""",
"""
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v4
""",
source -> source.path(".github/workflows/ci.yml")
)
);
}
}

0 comments on commit 4bbcf55

Please sign in to comment.