Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions .github/workflows/run-openrewrite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Run OpenRewrite

permissions:
contents: write
pull-requests: read

on:
workflow_dispatch:
inputs:
pr_number:
description: 'Pull Request number'
required: true
type: number

concurrency:
group: "${{ github.workflow }}-${{ github.head_ref || github.ref }}-${{ github.event_name }}"
cancel-in-progress: true

jobs:
rewrite:
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Fetch PR branch
run: |
gh pr checkout ${{ inputs.pr_number }}
env:
GH_TOKEN: ${{secrets.GH_TOKEN_JABREF_MACHINE_PR_APPROVE}}

- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 24.0.1
distribution: 'zulu'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Generate JBang cache key
id: cache-key
shell: bash
run: |
echo "cache_key=jbang-$(date +%F)" >> $GITHUB_OUTPUT
- name: Use cache
uses: actions/cache@v4
with:
lookup-only: true
path: ~/.jbang
key: ${{ steps.cache-key.outputs.cache_key }}
restore-keys:
jbang-
- name: Setup JBang
uses: jbangdev/setup-jbang@main

- name: Run rewrite
run: ./gradlew rewriteRun

- name: Commit and push changes
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
if git diff --quiet; then
echo "No changes to commit."
else
git add .
git commit -m "Fix issues using OpenRewrite"
git push
fi