Switch the Gradle build to org.gradlex.java-module plugins #2026
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: On PR opened/updated | |
on: | |
# _target is required | |
pull_request_target: | |
# default: opened, synchronize, reopened | |
jobs: | |
determine_issue_number: | |
name: Determine issue number | |
runs-on: ubuntu-latest | |
if: > | |
(github.repository == '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') | |
) | |
) | |
permissions: | |
contents: read | |
outputs: | |
issue_number: ${{ steps.get_issue_number.outputs.ticketNumber }} | |
steps: | |
- name: echo PR data | |
run: | | |
echo "PR Number: ${{ github.event.pull_request.number }}" | |
echo "PR URL: ${{ github.event.pull_request.html_url }}" | |
cat <<EOF | |
PR Body: | |
${{ github.event.pull_request.body }} | |
EOF | |
- name: Determine issue number | |
id: get_issue_number | |
uses: koppor/ticket-check-action@add-output | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
ticketLink: 'https://github.com/JabRef/jabref/issues/%ticketNumber%' | |
ticketPrefix: '#' | |
titleRegex: '^#(?<ticketNumber>\d+)' | |
branchRegex: '^(?<ticketNumber>\d+)' | |
# Matches GitHub's closes/fixes/resolves #{number}, but does not match our example `Closes #13109` in PULL_REQUEST_TEMPLATE | |
# Also matches URLs that are wrapped in `<>`. | |
bodyRegex: '(?<action>fixes|closes|resolves|refs)\s+<?(?:https?:\/\/github\.com\/JabRef\/jabref\/issues\/)?#?(?<ticketNumber>(?!13109\b)\d+)>?' | |
bodyRegexFlags: 'i' | |
outputOnly: true | |
- run: echo "${{ steps.get_issue_number.outputs.ticketNumber }}" | |
- name: Issue number present | |
if: steps.get_issue_number.outputs.ticketNumber == '-1' | |
run: | | |
echo "No valid ticket number found!" | |
exit 1 | |
move_issue: | |
name: Mark issue as in progress | |
# after determine_issue_number to ensure that there is only one failure because of no ticket number | |
needs: determine_issue_number | |
runs-on: ubuntu-latest | |
permissions: | |
issues: write | |
steps: | |
- name: Move issue to "In Progress" in "Good First Issues" | |
uses: m7kvqbe1/github-action-move-issues/@main | |
with: | |
github-token: ${{ secrets.GH_TOKEN_ACTION_MOVE_ISSUE }} | |
project-url: "https://github.com/orgs/JabRef/projects/5" | |
target-labels: "📍 Assigned" | |
target-column: "In Progress" | |
ignored-columns: "" | |
default-column: "In Progress" | |
issue-number: ${{ needs.determine_issue_number.outputs.issue_number }} | |
skip-if-not-in-project: true | |
- name: Move issue to "In Progress" in "Candidates for University Projects" | |
uses: m7kvqbe1/github-action-move-issues/@main | |
with: | |
github-token: ${{ secrets.GH_TOKEN_ACTION_MOVE_ISSUE }} | |
project-url: "https://github.com/orgs/JabRef/projects/3" | |
target-labels: "📍 Assigned" | |
target-column: "In Progress" | |
ignored-columns: "" | |
default-column: "In Progress" | |
issue-number: ${{ needs.determine_issue_number.outputs.issue_number }} | |
skip-if-not-in-project: true | |
ensure_assignment: | |
name: Ensure that contributor is assigned (fails if not commented on issue) | |
# after determine_issue_number to ensure that there is only one failure because of no ticket number | |
needs: determine_issue_number | |
runs-on: ubuntu-latest | |
permissions: | |
issues: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
show-progress: 'false' | |
- name: Assign PR creator to issue | |
run: | | |
set -e | |
echo "Updating issue '${{ needs.determine_issue_number.outputs.issue_number }}'" | |
# "gh issue edit" cannot be used - workaround found at https://github.com/cli/cli/issues/9620#issuecomment-2703135049 | |
ASSIGNEES=$(gh api /repos/JabRef/jabref/issues/${{ needs.determine_issue_number.outputs.issue_number }} --jq '[.assignees[].login]') | |
# Check if the user is already assigned | |
if echo "$ASSIGNEES" | jq -e '. | index("${{ github.event.pull_request.user.login }}")' >/dev/null; then | |
echo "User '${{ github.event.pull_request.user.login }}' is already an assignee. No update needed." | |
echo "Debug: $ASSIGNEES" | |
exit 0 | |
fi | |
# Append the new assignee | |
UPDATED_ASSIGNEES=$(echo "$ASSIGNEES" | jq --arg new "${{ github.event.pull_request.user.login }}" '. + [$new]') | |
# Update issue with the new assignee list | |
echo "Updating issue #${{ needs.determine_issue_number.outputs.issue_number }} updated with assignees: $UPDATED_ASSIGNEES..." | |
gh api -X PATCH /repos/JabRef/jabref/issues/${{ needs.determine_issue_number.outputs.issue_number }} --input <(echo "{\"assignees\": $UPDATED_ASSIGNEES}") | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Add label "📌 Pinned" | |
run: gh issue edit ${{ needs.determine_issue_number.outputs.issue_number }} --add-label "📌 Pinned" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
conflicts_with_target: | |
if: github.repository == 'JabRef/jabref' | |
name: Conflicts with target branch | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
show-progress: 'false' | |
- name: Check PR mergeability | |
id: check_mergeable | |
run: | | |
MERGEABLE=$(gh pr view --json mergeable ${{ github.event.number }} --template '{{.mergeable}}') | |
if [ "$MERGEABLE" == "CONFLICTING" ]; then | |
echo "❌ Merge conflicts" | |
exit 1 | |
fi | |
echo "✅ No merge conflicts" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
upload-pr-number: | |
if: github.repository == 'JabRef/jabref' | |
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 |