Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7ccd3e6

Browse files
authored
Run a subset of best practices against PRs (openrewrite#4232)
* Run a subset of best practices against PRs * Update receive-pr.yml
1 parent b8f884d commit 7ccd3e6

File tree

2 files changed

+82
-0
lines changed

2 files changed

+82
-0
lines changed

.github/workflows/comment-pr.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: comment-pr
2+
3+
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#using-data-from-the-triggering-workflow
4+
on:
5+
workflow_run:
6+
workflows: ["receive-pr"]
7+
types:
8+
- completed
9+
10+
# https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
11+
# Since this pull request has write permissions on the target repo, we should **NOT** execute any untrusted code.
12+
jobs:
13+
post-suggestions:
14+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
15+
uses: openrewrite/gh-automation/.github/workflows/comment-pr.yml@main

.github/workflows/receive-pr.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: receive-pr
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize]
6+
branches:
7+
- main
8+
9+
concurrency:
10+
group: '${{ github.workflow }} @ ${{ github.ref }}'
11+
cancel-in-progress: true
12+
13+
# https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
14+
# Since this pull request receives untrusted code, we should **NOT** have any secrets in the environment.
15+
jobs:
16+
upload-patch:
17+
uses: openrewrite/gh-automation/.github/workflows/receive-pr.yml@main
18+
with:
19+
recipe: 'org.openrewrite.recipes.OpenRewriteBestPracticesSubset'
20+
rewrite_yml: |
21+
---
22+
type: specs.openrewrite.org/v1beta/recipe
23+
name: org.openrewrite.recipes.OpenRewriteBestPracticesSubset
24+
displayName: OpenRewrite best practices
25+
description: Best practices for OpenRewrite recipe development.
26+
recipeList:
27+
- org.openrewrite.recipes.JavaRecipeBestPracticesSubset
28+
- org.openrewrite.recipes.RecipeTestingBestPracticesSubset
29+
- org.openrewrite.recipes.RecipeNullabilityBestPractices
30+
#- org.openrewrite.java.OrderImports
31+
- org.openrewrite.java.format.EmptyNewlineAtEndOfFile
32+
- org.openrewrite.staticanalysis.InlineVariable
33+
- org.openrewrite.staticanalysis.MissingOverrideAnnotation
34+
- org.openrewrite.staticanalysis.UseDiamondOperator
35+
---
36+
type: specs.openrewrite.org/v1beta/recipe
37+
name: org.openrewrite.recipes.JavaRecipeBestPracticesSubset
38+
displayName: Java Recipe best practices
39+
description: Best practices for Java recipe development.
40+
preconditions:
41+
- org.openrewrite.java.search.FindTypes:
42+
fullyQualifiedTypeName: org.openrewrite.Recipe
43+
checkAssignability: true
44+
recipeList:
45+
- org.openrewrite.java.recipes.ExecutionContextParameterName
46+
- org.openrewrite.java.recipes.MissingOptionExample
47+
- org.openrewrite.java.recipes.RecipeEqualsAndHashCodeCallSuper
48+
- org.openrewrite.java.recipes.UseTreeRandomId
49+
- org.openrewrite.staticanalysis.NeedBraces
50+
#- org.openrewrite.staticanalysis.RemoveSystemOutPrintln
51+
---
52+
type: specs.openrewrite.org/v1beta/recipe
53+
name: org.openrewrite.recipes.RecipeTestingBestPracticesSubset
54+
displayName: Recipe testing best practices
55+
description: Best practices for testing recipes.
56+
preconditions:
57+
- org.openrewrite.java.search.FindTypes:
58+
fullyQualifiedTypeName: org.openrewrite.test.RewriteTest
59+
checkAssignability: true
60+
recipeList:
61+
- org.openrewrite.java.recipes.RewriteTestClassesShouldNotBePublic
62+
#- org.openrewrite.java.recipes.SelectRecipeExamples
63+
- org.openrewrite.java.recipes.SourceSpecTextBlockIndentation
64+
- org.openrewrite.java.testing.cleanup.RemoveTestPrefix
65+
- org.openrewrite.java.testing.cleanup.TestsShouldNotBePublic
66+
- org.openrewrite.staticanalysis.NeedBraces
67+
- org.openrewrite.staticanalysis.RemoveSystemOutPrintln

0 commit comments

Comments
 (0)