Skip to content

Focus "Specify Bib(La)TeX" when Bib(La)TeX is in clipboard #697

Focus "Specify Bib(La)TeX" when Bib(La)TeX is in clipboard

Focus "Specify Bib(La)TeX" when Bib(La)TeX is in clipboard #697

Workflow file for this run

name: PR Tests
on:
pull_request:
concurrency:
group: "${{ github.workflow }}-${{ github.head_ref || github.ref }}"
cancel-in-progress: true
permissions:
pull-requests: write
jobs:
upload-pr-number:
runs-on: ubuntu-latest
steps:
- name: Create pr_number.txt
run: echo "${{ github.event.number }}" > pr_number.txt
- uses: actions/upload-artifact@v4
with:
name: pr_number
path: pr_number.txt
check_title_format:
name: PR title must not contain "issue <number>"
if: github.actor != 'dependabot[bot]' && github.event.pull_request.head.repo.full_name != 'JabRef/jabref'
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
submodules: 'false'
show-progress: 'false'
- name: Check PR title
run: |
TITLE=$(gh pr view "${{ github.event.number }}" --json title --template '{{.title}}')
echo "Title: $TITLE"
if echo "$TITLE" | grep -Eiq 'issue ?#?[0-9]+.+'; then
echo "❌ Title contains 'issue <number>' — not allowed."
exit 1
fi
echo "✅ Title format OK"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
mandatory-checks-section-exists:
if: >
(github.event.pull_request.head.repo.full_name != 'JabRef/jabref') && !(
(github.actor == 'dependabot[bot]') ||
(
startsWith(github.event.pull_request.title, '[Bot] ') ||
startsWith(github.event.pull_request.title, 'Bump ') ||
startsWith(github.event.pull_request.title, 'New Crowdin updates') ||
startsWith(github.event.pull_request.title, 'Update Gradle Wrapper from')
)
)
name: Mandatory Checks present
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
submodules: 'false'
show-progress: 'false'
- name: Check for existence of Mandatory Checks section
id: check_mandatory_section
run: |
set -e
BODY=$(gh pr view "${{ github.event.number }}" --json body --template '{{.body}}')
if echo "$BODY" | grep -q "### Mandatory checks"; then
echo "✅ '### Mandatory checks' section found."
else
echo "❌ '### Mandatory checks' section is missing!"
exit 1
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
checklist-checked:
if: >
(github.event.pull_request.head.repo.full_name != 'JabRef/jabref') &&
!(
(github.actor == 'dependabot[bot]') ||
(
startsWith(github.event.pull_request.title, '[Bot] ') ||
startsWith(github.event.pull_request.title, 'Bump ') ||
startsWith(github.event.pull_request.title, 'New Crowdin updates') ||
startsWith(github.event.pull_request.title, 'Update Gradle Wrapper from')
)
)
name: PR checklist OK
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
submodules: 'false'
show-progress: 'false'
- name: Check for PR checklist
id: check_changelog_modification
run: |
set -e
BODY=$(gh pr view "${{ github.event.number }}" --json body --template '{{.body}}' | grep -A5000 '### Mandatory checks')
echo "Found body: $BODY"
# Ensure the section exists
if ! printf '%s\n' "$BODY" | grep -q "### Mandatory checks"; then
echo "❌ '### Mandatory checks' section is missing!"
exit 1
fi
BOXES=$(printf '%s\n' "$BODY" | grep "^- \[")
echo "Found boxes: $BOXES"
while IFS= read -r line; do
if ! printf '%s\n' "$line" | grep -Eq "^- \[(x|/| )\] "; then
echo "❌ Found improperly formatted checkbox: '$line'"
exit 1
fi
done <<< "$BOXES"
LINE_COUNT=$(echo "$BOXES" | wc -l)
if [ "$LINE_COUNT" -ne 7 ]; then
echo "❌ Found $LINE_COUNT lines instead of 7 required lines"
exit 1
fi
echo "✅ All checkboxes are present and in the correct format."
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
changelog_modified:
name: CHANGELOG.md needs to be modified
if: github.actor != 'dependabot[bot]' && github.event.pull_request.head.repo.full_name != 'JabRef/jabref'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check PR body for changelog note
id: changelog_check
run: |
BODY=$(gh pr view "${{ github.event.number }}" --json body --template '{{.body}}')
echo "Body: $BODY"
if echo "$BODY" | grep -q '\- \[x\] Change in `CHANGELOG.md`'; then
echo "found"
echo "found=yes" >> $GITHUB_OUTPUT
else
echo "not found"
echo "found=no" >> $GITHUB_OUTPUT
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check for CHANGELOG.md modifications
id: check_changelog_modification
if: steps.changelog_check.outputs.found == 'yes'
run: |
git fetch origin ${{ github.base_ref }}
if git diff --name-only origin/${{ github.base_ref }}...HEAD | grep -q '^CHANGELOG\.md$'; then
echo "✅ CHANGELOG.md was modified"
else
echo "❌ CHANGELOG.md was NOT modified"
exit 1
fi
# This ensures that no git merge conflict markers (<<<, ...) are contained
merge_conflict_job:
name: Find merge conflicts
if: github.actor != 'dependabot[bot]' && github.event.pull_request.head.repo.full_name != 'JabRef/jabref'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
show-progress: 'false'
- name: Merge Conflict finder
uses: olivernybroe/[email protected]
no-force-push:
if: github.actor != 'dependabot[bot]' && github.event.pull_request.head.repo.full_name != 'JabRef/jabref'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check force push
id: force_push_check
run: |
if [[ -z "${{ github.event.before }}" ]]; then
echo "✅ New PR created."
exit 0
fi
if git cat-file -e ${{ github.event.before }} 2>/dev/null; then
echo "✅ Regular push detected."
exit 0
else
echo "❌ Force push detected"
exit 1
fi
unmodified_submodules:
name: Submodules not modified
if: github.actor != 'dependabot[bot]' && github.event.pull_request.head.repo.full_name != 'JabRef/jabref'
runs-on: ubuntu-latest
steps:
# No checkout -> the action uses GitHub's API (which is more reliable for submodule changes due to our submodule settings)
- name: Get all submodule changes
id: changes
uses: tj-actions/changed-files@v46
with:
files: |
jablib/src/main/abbrv.jabref.org
jablib/src/main/resources/csl-styles
jablib/src/main/resources/csl-locales
- name: Submodules modified
if: steps.changes.outputs.any_changed == 'true'
run: |
echo "❌ Submodule modifications detected"
exit 1
other_than_main:
name: Source branch is other than "main"
if: github.actor != 'dependabot[bot]' && github.event.pull_request.head.repo.full_name != 'JabRef/jabref'
runs-on: ubuntu-latest
steps:
- if: github.head_ref == 'main'
uses: actions/github-script@v7
with:
script: |
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. 👈')