Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ permissions:
jobs:
automerge:
runs-on: ubuntu-slim
if: github.repository == 'JabRef/jabref'
# In JabRef/jabref, on-pr-opened-updated.yml removes "automerge" when a human pushes; the black-forest
# repository has no such cleanup, so a human push there must not be acted on with a stale label.
if: >
github.repository == 'JabRef/jabref' ||
(github.repository == 'JabRef/jabref-black-forest' &&
!(github.event.action == 'synchronize' && !contains(fromJSON('["dependabot[bot]", "renovate-bot", "jabref-machine"]'), github.event.sender.login)))
# Serialize with on-pr-labeled.yml's automerge job (same group) so the
# approve guard never races: the second run starts only after the first
# finished and its approval is visible.
Expand Down Expand Up @@ -42,8 +47,8 @@ jobs:
exit 0
fi

if [[ "$HEAD_REPO" != "JabRef/jabref" ]]; then
echo "🚫 not from JabRef/jabref"
if [[ "$HEAD_REPO" != "$GITHUB_REPOSITORY" ]]; then
echo "🚫 not from $GITHUB_REPOSITORY"
echo "shouldrun=false" >> "$GITHUB_OUTPUT"
exit 0
fi
Expand Down
41 changes: 22 additions & 19 deletions .github/workflows/port-to-other-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -188,28 +188,31 @@ jobs:
merge_commits: skip
experimental: >
{"conflict_resolution": "draft_commit_conflicts", "downstream_repo": "${{ env.TARGET_REPO }}"}
- name: Auto-merge a clean port
if: steps.port.outputs.was_successful == 'true'
env:
# The port PR lives in the other repository, where only the PAT has rights. The label
# triggers "On PR labeled" there, which approves the port and enables auto-merge.
GH_TOKEN: ${{ secrets.GH_TOKEN_JABREF_MACHINE_PR_APPROVE }}
GH_REPO: JabRef/${{ env.TARGET_REPO }}
CREATED: ${{ steps.port.outputs.created_pull_numbers }}
run: |
for pr in $CREATED; do
gh pr edit "$pr" --add-label automerge
echo "✅ Port PR $GH_REPO#$pr opened with auto-merge" >> "$GITHUB_STEP_SUMMARY"
done
- name: Report a conflicting port
if: steps.target.outputs.exists == 'true' && steps.port.outputs.was_successful != 'true'
- name: Label the port PR
if: steps.target.outputs.exists == 'true'
env:
# The port PR lives in the other repository, where only the PAT has rights; labels go through
# `gh api`, because `gh pr edit` needs the read:org scope the token lacks. The "automerge"
# label triggers "On PR labeled" there, which approves the port and enables auto-merge.
GH_TOKEN: ${{ secrets.GH_TOKEN_JABREF_MACHINE_PR_APPROVE }}
GH_REPO: JabRef/${{ env.TARGET_REPO }}
TARGET_FULL: JabRef/${{ env.TARGET_REPO }}
CREATED: ${{ steps.port.outputs.created_pull_numbers }}
run: |
set -euo pipefail
if [ -z "$CREATED" ]; then
echo "❌ No port PR was opened for #$PR_NUMBER" | tee -a "$GITHUB_STEP_SUMMARY"
exit 1
fi
# The action also reports a committed conflict as successful; the draft state tells them apart
conflict=false
for pr in $CREATED; do
gh pr edit "$pr" --add-label "status: changes-required"
if [ "$(gh api "repos/$TARGET_FULL/pulls/$pr" --jq .draft)" = "true" ]; then
gh api "repos/$TARGET_FULL/issues/$pr/labels" -f "labels[]=status: changes-required" > /dev/null
echo "❌ Port of #$PR_NUMBER to \`$TARGET\` conflicts - resolve it in the draft port PR $TARGET_FULL#$pr" | tee -a "$GITHUB_STEP_SUMMARY"
conflict=true
else
gh api "repos/$TARGET_FULL/issues/$pr/labels" -f "labels[]=automerge" > /dev/null
echo "✅ Port PR $TARGET_FULL#$pr opened with auto-merge" >> "$GITHUB_STEP_SUMMARY"
fi
done
echo "❌ Port of #$PR_NUMBER to \`$TARGET\` of $GH_REPO conflicts - resolve it in the draft port PR ${CREATED:+$GH_REPO#$CREATED}" | tee -a "$GITHUB_STEP_SUMMARY"
exit 1
[ "$conflict" = false ]
7 changes: 7 additions & 0 deletions GitVersion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,10 @@ branches:
# (v6.0-alpha.6 + 956 commits reached 34956, hence 50000 for beta). Stay below 60000: GitVersion always uses that for a stable release.
# Ignored while `label` is empty.
pre-release-weight: 50000
# Release branch of JabRef/jabref-black-forest; that repository has no `main`, so pull requests there need it as a source
black-forest:
regex: ^black-forest$
label: ''
is-main-branch: true
pull-request:
source-branches: [main, black-forest]
Loading