Skip to content

Commit b485901

Browse files
authored
Add run openrewrite (#13524)
1 parent 9392108 commit b485901

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

.github/workflows/run-openrewrite.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Run OpenRewrite
2+
3+
permissions:
4+
contents: write
5+
pull-requests: read
6+
7+
on:
8+
workflow_dispatch:
9+
inputs:
10+
pr_number:
11+
description: 'Pull Request number'
12+
required: true
13+
type: number
14+
15+
concurrency:
16+
group: "${{ github.workflow }}-${{ github.head_ref || github.ref }}-${{ github.event_name }}"
17+
cancel-in-progress: true
18+
19+
jobs:
20+
rewrite:
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- name: Checkout repo
25+
uses: actions/checkout@v4
26+
27+
- name: Fetch PR branch
28+
run: |
29+
gh pr checkout ${{ inputs.pr_number }}
30+
env:
31+
GH_TOKEN: ${{secrets.GH_TOKEN_JABREF_MACHINE_PR_APPROVE}}
32+
33+
- name: Set up JDK
34+
uses: actions/setup-java@v4
35+
with:
36+
java-version: 24.0.1
37+
distribution: 'zulu'
38+
- name: Setup Gradle
39+
uses: gradle/actions/setup-gradle@v4
40+
- name: Generate JBang cache key
41+
id: cache-key
42+
shell: bash
43+
run: |
44+
echo "cache_key=jbang-$(date +%F)" >> $GITHUB_OUTPUT
45+
- name: Use cache
46+
uses: actions/cache@v4
47+
with:
48+
lookup-only: true
49+
path: ~/.jbang
50+
key: ${{ steps.cache-key.outputs.cache_key }}
51+
restore-keys:
52+
jbang-
53+
- name: Setup JBang
54+
uses: jbangdev/setup-jbang@main
55+
56+
- name: Run rewrite
57+
run: ./gradlew rewriteRun
58+
59+
- name: Commit and push changes
60+
run: |
61+
git config user.name "github-actions[bot]"
62+
git config user.email "github-actions[bot]@users.noreply.github.com"
63+
if git diff --quiet; then
64+
echo "No changes to commit."
65+
else
66+
git add .
67+
git commit -m "Fix issues using OpenRewrite"
68+
git push
69+
fi

0 commit comments

Comments
 (0)