Skip to content

Tell a conflicting port from a clean one by its draft state - #17608

Closed
koppor wants to merge 1 commit into
mainfrom
port-job-draft-labels
Closed

koppor wants to merge 1 commit into
mainfrom
port-job-draft-labels

Conversation

@koppor

@koppor koppor commented Oct 27, 2026

Copy link
Copy Markdown
Member

Summary

The first cross-repository port (JabRef#11) showed two gaps in the port job: the backport action reports a committed conflict as success, so the draft got the automerge path, and the label call failed because gh pr edit needs a token scope the jabref-machine token lacks. The job now tells the two cases apart by the draft state and labels through the API. Dependabot pull requests in JabRef/jabref-black-forest are auto-merged the same way as here.

Analogies: honey that looks set but is still runny needs a second look before the jar is labelled; chocolate gets the same wrapper in both shops; the moon shows the same face to both repositories.

jabref-contrib-policy:4.2:reviewed​:ok

Steps to test

  1. Merge a PR with dev: send-to-black-forest that applies cleanly: the port PR in JabRef/jabref-black-forest gets automerge and the run is green.
  2. Merge one that conflicts: the draft port PR gets status: changes-required and the run is red.
  3. In JabRef/jabref-black-forest, a Dependabot PR is approved and auto-merge enabled once this file is on black-forest.

Related issues and pull requests

Closes _____

Triggered by https://github.com/JabRef/jabref/actions/runs/40599392673 (port of #17606).

AI usage

Claude Code (model claude-fable-5-1), AIL4.

AI CHECKLIST.md walkthrough
  • [/] No == null / != null checks — JSpecify annotations used instead.
  • [/] No Objects.requireNonNull(...).
  • [/] New classes annotated with @NullMarked.
  • [/] New packages annotated with @NullMarked.
  • [/] Optional consumed with ifPresent / map / orElseThrow.
  • [/] StringUtil.isBlank(...) used.
  • [/] No catch (Exception e).
  • [/] No throw new RuntimeException(...) / IllegalStateException(...).
  • [/] Logged exceptions passed as the last logger argument.
  • [/] New BibEntry objects built with withers.
  • [/] Modern Java used.
  • [/] Regexes use a precompiled Pattern.
  • [/] Alphabetical ordering kept.
  • [/] Background work uses BackgroundTask.
  • No commented-out code, no trivial comments, no AI-disclosure comments in source.
  • [/] Markdown Javadoc uses Markdown syntax.
  • [/] All user-facing text localized.
  • [/] Sentence case; no trailing !; labels do not end with :.
  • [/] Variance expressed with placeholders.
  • [/] User-controlled data HTML-escaped.
  • [/] Issue example covered by a test case.
  • [/] Behavior changes in org.jabref.model / org.jabref.logic have tests.
  • [/] Tests assert object contents, plain JUnit asserts.
  • [/] Fetcher tests hit the live endpoints.
  • [/] ./gradlew :jablib:check (workflow-only change).
  • [/] ./gradlew checkstyleMain checkstyleTest checkstyleJmh.
  • [/] ./gradlew modernizer.
  • [/] ./gradlew --no-configuration-cache :rewriteDryRun.
  • [/] ./gradlew javadoc.
  • [/] npx markdownlint-cli2 (no Markdown changed).
  • [/] npm run textlint (no Markdown changed).
  • [/] intellij-format.
  • [/] CHANGELOG.md entry (not user-visible).
  • [/] Searched for a related issue (triggered by a workflow run).
  • [/] Requirement added (existing requirement unchanged).
  • [/] Developer documentation (behavior as documented).
  • PR body built from the template, every section filled.
  • All checklist items kept and marked.
  • [/] "Steps to test" screenshots (no UI change).
  • All HTML comments removed from the PR body.
  • PR created with gh pr create --body-file.
  • [/] CHANGELOG.md TODO placeholder.

Checklist

  • I own the copyright of the code submitted and I license it under the MIT license
  • If AI tools were used, I disclosed them in the "AI usage" section and reviewed, understood, and take full ownership of all AI-generated code
  • [/] I manually tested my changes in running JabRef (always required)
  • [/] I added JUnit tests for changes (if applicable)
  • [/] I added screenshots in the PR description (if change is visible to the user)
  • [/] I added one sentence (max 20 words) to CHANGELOG.md describing the change from the user's point of view (if the change is visible to the user)
  • [/] I checked the user documentation for up to dateness and submitted a pull request to our user documentation repository

🤖 Generated with Claude Code

The backport action reports a committed conflict as success, so the first cross-repository port got the automerge label and the labeling failed on a missing token scope. Dependabot pull requests in the black-forest repository are auto-merged like here.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@koppor koppor added the dev: send-to-black-forest Port to the black-forest branch of JabRef/jabref-black-forest after merging (ADR-0073) label Oct 27, 2026
@koppor
koppor marked this pull request as ready for review October 27, 2026 23:08
@qodo-free-for-open-source-projects

Copy link
Copy Markdown
Contributor

PR Summary by Qodo

Distinguish conflicting port PRs and enable Black Forest auto-merge

🐞 Bug fix ✨ Enhancement 🕐 20-40 Minutes

Grey Divider

AI Description

• Label draft port PRs as requiring changes instead of sending conflicts to auto-merge.
• Use the GitHub API to label cross-repository ports with the available token.
• Enable the existing Dependabot auto-merge workflow in jabref-black-forest.
Diagram

graph TD
  A["Merged PR"] --> B["Backport action"] --> C{"Draft PR?"}
  C -->|Yes| D["Changes required"]
  C -->|No| E["Automerge label"] --> F["Labeled workflow"]
  G["Dependabot PR"] --> H["Automerge workflow"]
Loading
High-Level Assessment

Using the created PR’s draft state is appropriate because the backport action reports committed conflicts as successful. Querying the PR and applying labels through the GitHub API also avoids the token-scope requirement encountered with gh pr edit; relying on the action’s success output or inspecting conflict markers would not improve this flow.

Files changed (2) +25 / -22

Enhancement (1) +3 / -3
automerge.ymlRun auto-merge in both JabRef repositories +3/-3

Run auto-merge in both JabRef repositories

• Allows the workflow to run in jabref-black-forest as well as jabref. Its same-repository head check now compares against the repository running the workflow, preserving eligibility for Dependabot and other qualifying PRs there.

.github/workflows/automerge.yml

Bug fix (1) +22 / -19
port-to-other-branch.ymlLabel ports according to draft state +22/-19

Label ports according to draft state

• Queries each created port PR’s draft state instead of trusting the backport action’s success output. Labels draft ports as requiring changes and fails the job; labels non-draft ports for auto-merge through the GitHub API, and fails if no port PR was created.

.github/workflows/port-to-other-branch.yml

@github-actions github-actions Bot added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Oct 27, 2026
@qodo-free-for-open-source-projects

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can describe a rule in plain language on the Rules page and Qodo drafts it for you

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@koppor koppor added dev: send-to-black-forest Port to the black-forest branch of JabRef/jabref-black-forest after merging (ADR-0073) and removed dev: send-to-black-forest Port to the black-forest branch of JabRef/jabref-black-forest after merging (ADR-0073) labels Oct 27, 2026
@koppor koppor closed this Oct 27, 2026
@koppor
koppor deleted the port-job-draft-labels branch October 27, 2026 23:18
koppor added a commit to JabRef/jabref-black-forest that referenced this pull request Oct 27, 2026
This repository has no main branch, so GitVersion found no source for pull requests and the binaries job failed before building. Same change as JabRef#17608.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@koppor

koppor commented Oct 27, 2026

Copy link
Copy Markdown
Member Author

🤖 Generated with Claude Code
Superseded by #17609: branch renamed, since a port- prefix excludes the PR from porting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dev: ci-cd dev: send-to-black-forest Port to the black-forest branch of JabRef/jabref-black-forest after merging (ADR-0073) size: small status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant