1- name : Tests
1+ name : Source Code Tests
22
33on :
44 push :
@@ -25,6 +25,16 @@ permissions:
2525 pull-requests : write
2626
2727jobs :
28+ upload-pr-number :
29+ runs-on : ubuntu-latest
30+ steps :
31+ - name : Create pr_number.txt
32+ run : echo "${{ github.event.number }}" > pr_number.txt
33+ - uses : actions/upload-artifact@v4
34+ with :
35+ name : pr_number
36+ path : pr_number.txt
37+
2838 checkstyle :
2939 name : Checkstyle
3040 runs-on : ubuntu-latest
@@ -441,204 +451,3 @@ jobs:
441451 with :
442452 show-progress : ' false'
443453 - uses : gradle/actions/wrapper-validation@v4
444-
445- mandatory-checks-section-exists :
446- if : >
447- github.event_name == 'pull_request' && !(
448- (github.actor == 'dependabot[bot]') ||
449- (
450- startsWith(github.event.pull_request.title, '[Bot] ') ||
451- startsWith(github.event.pull_request.title, 'Bump ') ||
452- startsWith(github.event.pull_request.title, 'New Crowdin updates') ||
453- startsWith(github.event.pull_request.title, 'Update Gradle Wrapper from')
454- )
455- )
456- name : Mandatory Checks present
457- runs-on : ubuntu-latest
458- steps :
459- - name : Checkout source
460- uses : actions/checkout@v4
461- with :
462- submodules : ' false'
463- show-progress : ' false'
464-
465- - name : Check for existence of Mandatory Checks section
466- id : check_mandatory_section
467- run : |
468- set -e
469-
470- BODY=$(gh pr view "${{ github.event.number }}" --json body --template '{{.body}}')
471-
472- if echo "$BODY" | grep -q "### Mandatory checks"; then
473- echo "✅ '### Mandatory checks' section found."
474- else
475- echo "❌ '### Mandatory checks' section is missing!"
476- exit 1
477- fi
478- env :
479- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
480-
481- checklist-checked :
482- if : >
483- (github.repository_owner != 'JabRef') &&
484- (github.event_name == 'pull_request') && !(
485- (github.actor == 'dependabot[bot]') ||
486- (
487- startsWith(github.event.pull_request.title, '[Bot] ') ||
488- startsWith(github.event.pull_request.title, 'Bump ') ||
489- startsWith(github.event.pull_request.title, 'New Crowdin updates') ||
490- startsWith(github.event.pull_request.title, 'Update Gradle Wrapper from')
491- )
492- )
493- name : PR checklist OK
494- runs-on : ubuntu-latest
495- steps :
496- - name : Checkout source
497- uses : actions/checkout@v4
498- with :
499- submodules : ' false'
500- show-progress : ' false'
501- - name : Check for PR checklist
502- id : check_changelog_modification
503- run : |
504- set -e
505-
506- BODY=$(gh pr view "${{ github.event.number }}" --json body --template '{{.body}}' | grep -A5000 '### Mandatory checks')
507- echo "Found body: $BODY"
508-
509- # Ensure the section exists
510- if ! printf '%s\n' "$BODY" | grep -q "### Mandatory checks"; then
511- echo "❌ '### Mandatory checks' section is missing!"
512- exit 1
513- fi
514-
515- BOXES=$(printf '%s\n' "$BODY" | grep "^- \[")
516- echo "Found boxes: $BOXES"
517-
518- while IFS= read -r line; do
519- if ! printf '%s\n' "$line" | grep -Eq "^- \[(x|/| )\] "; then
520- echo "❌ Found improperly formatted checkbox: '$line'"
521- exit 1
522- fi
523- done <<< "$BOXES"
524-
525- LINE_COUNT=$(echo "$BOXES" | wc -l)
526-
527- if [ "$LINE_COUNT" -ne 7 ]; then
528- echo "❌ Found $LINE_COUNT lines instead of 7 required lines"
529- exit 1
530- fi
531-
532- echo "✅ All checkboxes are present and in the correct format."
533- env :
534- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
535-
536- # This ensures that no git merge conflict markers (<<<, ...) are contained
537- merge_conflict_job :
538- name : Find merge conflicts
539- runs-on : ubuntu-latest
540- steps :
541- - uses : actions/checkout@v4
542- with :
543- show-progress : ' false'
544- - name : Merge Conflict finder
545- uses :
olivernybroe/[email protected] 546-
547- no-force-push :
548- if : github.event_name == 'pull_request'
549- runs-on : ubuntu-latest
550- steps :
551- - name : Checkout repository
552- uses : actions/checkout@v4
553- with :
554- fetch-depth : 0
555- - name : Check force push
556- id : force_push_check
557- run : |
558- if [[ -z "${{ github.event.before }}" ]]; then
559- echo "✅ New PR created."
560- exit 0
561- fi
562- if git cat-file -e ${{ github.event.before }} 2>/dev/null; then
563- echo "✅ Regular push detected."
564- exit 0
565- else
566- echo "❌ Force push detected"
567- exit 1
568- fi
569-
570- unmodified_submodules :
571- name : Submodules not modified
572- if : (github.actor != 'dependabot[bot]' && github.event_name == 'pull_request')
573- runs-on : ubuntu-latest
574- steps :
575- # No checkout -> the action uses GitHub's API (which is more reliable for submodule changes due to our submodule settings)
576- - name : Get all submodule changes
577- id : changes
578- uses : tj-actions/changed-files@v46
579- with :
580- files : |
581- jablib/src/main/abbrv.jabref.org
582- jablib/src/main/resources/csl-styles
583- jablib/src/main/resources/csl-locales
584- - name : Submodules modified
585- if : steps.changes.outputs.any_changed == 'true'
586- run : |
587- echo "❌ Submodule modifications detected"
588- exit 1
589-
590- other_than_main :
591- if : github.event_name == 'pull_request'
592- name : Source branch is other than "main"
593- runs-on : ubuntu-latest
594- steps :
595- - if : github.head_ref == 'main'
596- uses : actions/github-script@v7
597- with :
598- script : |
599- core.setFailed('Pull requests should come from a branch other than "main"\n\n👉 Please read [the CONTRIBUTING guide](https://github.com/JabRef/jabref/blob/main/CONTRIBUTING.md#contributing) carefully again. 👈')
600-
601- upload-pr-number :
602- runs-on : ubuntu-latest
603- steps :
604- - name : Create pr_number.txt
605- run : echo "${{ github.event.number }}" > pr_number.txt
606- - uses : actions/upload-artifact@v4
607- with :
608- name : pr_number
609- path : pr_number.txt
610-
611- changelog_modified :
612- name : CHANGELOG.md needs to be modified
613- if : github.actor != 'dependabot[bot]' && github.event_name == 'pull_request'
614- runs-on : ubuntu-latest
615- steps :
616- - uses : actions/checkout@v4
617- with :
618- fetch-depth : 0
619- - name : Check PR body for changelog note
620- id : changelog_check
621- run : |
622- BODY=$(gh pr view "${{ github.event.number }}" --json body --template '{{.body}}')
623- echo "Body: $BODY"
624-
625- if echo "$BODY" | grep -q '\- \[x\] Change in `CHANGELOG.md`'; then
626- echo "found"
627- echo "found=yes" >> $GITHUB_OUTPUT
628- else
629- echo "not found"
630- echo "found=no" >> $GITHUB_OUTPUT
631- fi
632- env :
633- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
634- - name : Check for CHANGELOG.md modifications
635- id : check_changelog_modification
636- if : steps.changelog_check.outputs.found == 'yes'
637- run : |
638- git fetch origin ${{ github.base_ref }}
639- if git diff --name-only origin/${{ github.base_ref }}...HEAD | grep -q '^CHANGELOG\.md$'; then
640- echo "✅ CHANGELOG.md was modified"
641- else
642- echo "❌ CHANGELOG.md was NOT modified"
643- exit 1
644- fi
0 commit comments