Skip to content

Commit 11738ef

Browse files
authored
Merge branch 'main' into main
2 parents eb18adf + 6f8d28f commit 11738ef

File tree

49 files changed

+927
-518
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+927
-518
lines changed

.devcontainer/devcontainer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
// Install java.
3232
// See https://github.com/devcontainers/features/tree/main/src/java#options for details.
3333
"ghcr.io/devcontainers/features/java:1": {
34-
"version": "24.0.1-tem",
34+
"version": "24.0.1-amzn",
3535
"installGradle": false,
36-
"jdkDistro": "Temurin"
36+
"jdkDistro": "Corretto"
3737
}
3838
}
3939
}

.github/ghprcomment.yml

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Compilation, tests, and code style
22

33
- jobName: windows installer and portable version
4+
workflowName: 'Source Code Tests'
45
message: >
56
Your code does not compile.
67
Please ensure your changes compile successfully before pushing changes.
@@ -9,6 +10,7 @@
910
To verify compilation locally, run `./gradlew build` or try running JabRef.
1011
1112
- jobName: 'Unit tests – jablib'
13+
workflowName: 'Source Code Tests'
1214
message: >
1315
JUnit tests of `jablib` are failing.
1416
You can see which checks are failing by locating the box "Some checks were not successful" on the pull request page.
@@ -18,6 +20,7 @@
1820
You can then run these tests in IntelliJ to reproduce the failing tests locally.
1921
We offer a quick test running howto in the section [Final build system checks](https://devdocs.jabref.org/getting-into-the-code/guidelines-for-setting-up-a-local-workspace/intellij-12-build.html#final-build-system-checks) in our setup guide.
2022
- jobName: 'Unit tests – jabkit'
23+
workflowName: 'Source Code Tests'
2124
message: >
2225
JUnit tests of `jabkit` are failing.
2326
You can see which checks are failing by locating the box "Some checks were not successful" on the pull request page.
@@ -27,6 +30,7 @@
2730
You can then run these tests in IntelliJ to reproduce the failing tests locally.
2831
We offer a quick test running howto in the section [Final build system checks](https://devdocs.jabref.org/getting-into-the-code/guidelines-for-setting-up-a-local-workspace/intellij-12-build.html#final-build-system-checks) in our setup guide.
2932
- jobName: 'Unit tests – jabsrv'
33+
workflowName: 'Source Code Tests'
3034
message: >
3135
JUnit tests of `jabsrv` are failing.
3236
You can see which checks are failing by locating the box "Some checks were not successful" on the pull request page.
@@ -36,6 +40,7 @@
3640
You can then run these tests in IntelliJ to reproduce the failing tests locally.
3741
We offer a quick test running howto in the section [Final build system checks](https://devdocs.jabref.org/getting-into-the-code/guidelines-for-setting-up-a-local-workspace/intellij-12-build.html#final-build-system-checks) in our setup guide.
3842
- jobName: Checkstyle
43+
workflowName: 'Source Code Tests'
3944
message: >
4045
Your code currently does not meet [JabRef's code guidelines](https://devdocs.jabref.org/getting-into-the-code/guidelines-for-setting-up-a-local-workspace/intellij-13-code-style.html).
4146
We use [Checkstyle](https://checkstyle.sourceforge.io/) to identify issues.
@@ -50,6 +55,7 @@
5055
Please carefully follow [the setup guide for the codestyle](https://devdocs.jabref.org/getting-into-the-code/guidelines-for-setting-up-a-local-workspace/intellij-13-code-style.html).
5156
Afterwards, please [run checkstyle locally](https://devdocs.jabref.org/getting-into-the-code/guidelines-for-setting-up-a-local-workspace/intellij-13-code-style.html#run-checkstyle) and fix the issues, commit, and push.
5257
- jobName: OpenRewrite
58+
workflowName: 'Source Code Tests'
5359
message: >
5460
Your code currently does not meet JabRef's code guidelines.
5561
We use [OpenRewrite](https://docs.openrewrite.org/) to ensure "modern" Java coding practices.
@@ -60,6 +66,7 @@
6066
The issues found can be **automatically fixed**.
6167
Please execute the gradle task *`rewriteRun`* from the [`rewrite` group of the Gradle Tool window](https://devdocs.jabref.org/code-howtos/faq.html#failing-openrewrite-tests) in IntelliJ, then check the results, commit, and push.
6268
- jobName: Modernizer
69+
workflowName: 'Source Code Tests'
6370
message: >
6471
Your code currently does not meet JabRef's code guidelines.
6572
We use [Gradle Modernizer Plugin](https://github.com/andygoossens/gradle-modernizer-plugin#gradle-modernizer-plugin) to ensure "modern" Java coding practices.
@@ -72,6 +79,7 @@
7279
# CHANGELOG.md and *.md
7380

7481
- jobName: 'CHANGELOG.md needs to be modified'
82+
workflowName: 'PR Tests'
7583
message: >
7684
You ticked that you modified `CHANGELOG.md`, but no new entry was found there.
7785
@@ -80,12 +88,14 @@
8088
If you did not, please replace the cross (`[x]`) by a slash (`[/]`) to indicate that no `CHANGELOG.md` entry is necessary.
8189
More details can be found in our [Developer Documentation about the changelog](https://devdocs.jabref.org/decisions/0007-human-readable-changelog.html).
8290
- jobName: 'CHANGELOG.md - only unreleased touched'
91+
workflowName: 'Source Code Tests'
8392
message: >
8493
While the PR was in progress, a new version of JabRef has been released.
8594
8695
8796
You have to merge `upstream/main` and move your entry in `CHANGELOG.md` up to the section `## [Unreleased]`.
8897
- jobName: CHANGELOG.md
98+
workflowName: 'Source Code Tests'
8999
message: >
90100
You modified `CHANGELOG.md` and did not meet JabRef's rules for consistently formatted Markdown files.
91101
To ensure consistent styling, we have [markdown-lint](https://github.com/DavidAnson/markdownlint) in place.
@@ -94,6 +104,7 @@
94104
95105
You can check the detailed error output by navigating to your pull request, selecting the tab "Checks", section "Tests" (on the left), subsection "CHANGELOG.md".
96106
- jobName: Markdown
107+
workflowName: 'Source Code Tests'
97108
message: >
98109
You modified Markdown (`*.md`) files and did not meet JabRef's rules for consistently formatted Markdown files.
99110
To ensure consistent styling, we have [markdown-lint](https://github.com/DavidAnson/markdownlint) in place.
@@ -106,12 +117,14 @@
106117
# Submodules and branches
107118

108119
- jobName: 'Submodules not modified'
120+
workflowName: 'PR Tests'
109121
message: >
110122
Your pull request modified git submodules.
111123
112124
113125
Please follow our [FAQ on submodules](https://devdocs.jabref.org/code-howtos/faq.html#submodules) to fix.
114126
- jobName: no-force-push
127+
workflowName: 'PR Tests'
115128
always: true
116129
message: >
117130
Hey, we noticed that you **force-pushed** your changes.
@@ -122,13 +135,15 @@
122135
123136
In future, **please avoid that**. For now, you can continue working.
124137
- jobName: 'Conflicts with target branch'
138+
workflowName: 'On PR opened/updated'
125139
message: >
126140
Your pull request conflicts with the target branch.
127141
128142
129143
Please [merge `upstream/main`](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork#syncing-a-fork-branch-from-the-command-line) with your code.
130144
For a step-by-step guide to resolve merge conflicts, see <https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/addressing-merge-conflicts/resolving-a-merge-conflict-using-the-command-line>.
131145
- jobName: 'Source branch is other than "main"'
146+
workflowName: 'PR Tests'
132147
message: >
133148
You committed your code on the `main` brach of your fork. This is a bad practice.
134149
The right way is to branch out from `main`, work on your patch/feature in that new branch, and then get that branch merged via the pull request (see [GitHub flow](https://docs.github.com/en/get-started/using-github/github-flow)).
@@ -139,17 +154,36 @@
139154
See [CONTRIBUTING.md](https://github.com/JabRef/jabref/blob/main/CONTRIBUTING.md#pull-request-process) for more details.
140155
141156
142-
# PR text
157+
# PR hygiene
143158

159+
- jobName: 'Ensure that contributor is assigned (fails if not commented on issue)'
160+
workflowName: 'On PR opened/updated'
161+
message: >
162+
You did not assign yourself to the issue.
163+
Thus, it looks like you skipped reading our [CONTRIBUTING.md](https://github.com/JabRef/jabref/blob/main/CONTRIBUTING.md), which explains exactly how to participate. No worries, it happens to the best of us.
164+
165+
166+
Give it a read, and you’ll discover the ancient wisdom of assigning issues to yourself. Trust me, it’s worth it. 🚀
167+
168+
- jobName: 'PR title must not start with "Fix for issue <number>"'
169+
workflowName: 'PR Tests'
170+
always: true
171+
message: >
172+
The title of the pull request must not start with "Fix for issue xyz".
173+
Please use a concise one-line summary that explains what the fix or change actually does.
174+
Example of a good title: "Prevent crash when importing malformed BibTeX entries".
144175
- jobName: 'Mandatory Checks present'
176+
workflowName: 'PR Tests'
145177
always: true
146178
message: >
147179
You have removed the "Mandatory Checks" section from your pull request description. Please adhere to our [pull request template](https://github.com/JabRef/jabref/blob/main/.github/PULL_REQUEST_TEMPLATE.md?plain=1#L10).
148180
- jobName: 'PR checklist OK'
181+
workflowName: 'PR Tests'
149182
always: true
150183
message: >
151184
Note that your PR will not be reviewed/accepted until you have gone through the mandatory checks in the description and marked each of them them exactly in the format of `[x]` (done), `[ ]` (not done yet) or `[/]` (not applicable).
152185
- jobName: 'Determine issue number'
186+
workflowName: 'PR Tests'
153187
always: true
154188
message: |
155189
Your pull request needs to link an issue correctly.

.github/workflows/on-pr-opened-updated.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ jobs:
8585
skip-if-not-in-project: true
8686
ensure_assignment:
8787
name: Ensure that contributor is assigned (fails if not commented on issue)
88+
if: github.event.pull_request.head.repo.full_name != 'JabRef/jabref'
8889
# after determine_issue_number to ensure that there is only one failure because of no ticket number
8990
needs: determine_issue_number
9091
runs-on: ubuntu-latest
@@ -114,10 +115,22 @@ jobs:
114115
# Append the new assignee
115116
UPDATED_ASSIGNEES=$(echo "$ASSIGNEES" | jq --arg new "${{ github.event.pull_request.user.login }}" '. + [$new]')
116117
118+
LABELS=$(gh api repos/${{ github.repository }}/issues/${{ needs.determine_issue_number.outputs.issue_number }}/labels --jq '.[].name')
119+
if echo "$LABELS" | grep -q "^good"; then
120+
echo "✅ label good found"
121+
SILENT=false
122+
else
123+
echo "🚫 Silent fail if not possible to add assignee"
124+
SILENT=true
125+
fi
126+
117127
# Update issue with the new assignee list
118128
echo "Updating issue #${{ needs.determine_issue_number.outputs.issue_number }} updated with assignees: $UPDATED_ASSIGNEES..."
119-
gh api -X PATCH /repos/JabRef/jabref/issues/${{ needs.determine_issue_number.outputs.issue_number }} --input <(echo "{\"assignees\": $UPDATED_ASSIGNEES}")
120-
129+
if [ "$SILENT" = true ]; then
130+
gh api -X PATCH /repos/JabRef/jabref/issues/${{ needs.determine_issue_number.outputs.issue_number }} --input <(echo "{\"assignees\": $UPDATED_ASSIGNEES}") || true
131+
else
132+
gh api -X PATCH /repos/JabRef/jabref/issues/${{ needs.determine_issue_number.outputs.issue_number }} --input <(echo "{\"assignees\": $UPDATED_ASSIGNEES}")
133+
fi
121134
env:
122135
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
123136
- name: Add label "📌 Pinned"

.github/workflows/pr-comment.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name: Comment on PR
77

88
on:
99
workflow_run:
10-
workflows: ["Tests", "On PR opened/updated"]
10+
workflows: ["Source Code Tests", "On PR opened/updated", "PR Tests"]
1111
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#running-a-workflow-based-on-the-conclusion-of-another-workflow
1212
types: [completed]
1313
workflow_dispatch:
@@ -88,7 +88,7 @@ jobs:
8888

8989
# This step runs in both cases using the proper variables.
9090
- name: ghprcomment@main
91-
if: ${{ steps.check-label.outputs.has_label == 'false' && (github.event_name == 'workflow_dispatch' || (steps.read-pr_number.outputs.pr_number != '' && steps.isCrossRepository.outputs.isCrossRepository == 'true')) }}
91+
if: ${{ github.event_name == 'workflow_dispatch' || (steps.check-label.outputs.has_label == 'false' && steps.read-pr_number.outputs.pr_number != '' && steps.isCrossRepository.outputs.isCrossRepository == 'true') }}
9292
uses: jbangdev/jbang-action@v0.126.3
9393
with:
9494
script: https://github.com/koppor/ghprcomment/blob/main/ghprcomment.java

.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)