Skip to content

ci: add reusable label-driven backport workflow#1

Merged
ionite34 merged 2 commits into
mainfrom
feat/reusable-backport-workflow
Jul 4, 2026
Merged

ci: add reusable label-driven backport workflow#1
ionite34 merged 2 commits into
mainfrom
feat/reusable-backport-workflow

Conversation

@ionite34

@ionite34 ionite34 commented Jul 4, 2026

Copy link
Copy Markdown
Member

Lifts StabilityMatrix's backport.yml into an org-level reusable workflow (same pattern as csharpier-check.yml) so all repos get label-driven backports from a thin caller:

name: Automatic Backport
on:
  pull_request:
    types: [closed, labeled]
permissions:
  contents: write
  pull-requests: write
  issues: write
jobs:
  backport:
    uses: LykosAI/.github/.github/workflows/backport.yml@main
    secrets: inherit

lykos-backport GitHub App (optional, graceful)

When the org variable BACKPORT_APP_ID and org secret BACKPORT_APP_PRIVATE_KEY are set (reached via the caller's secrets: inherit), the workflow mints an installation token with actions/create-github-app-token@v3. Backport PRs are then authored by the lykos-backport App — its name + avatar — and, crucially, trigger CI (PRs opened with the default GITHUB_TOKEN don't). The if: vars.BACKPORT_APP_ID != '' gate means it skips cleanly and falls back to GITHUB_TOKEN when the App isn't configured, so this can merge before the App exists.

Differences from the SM original

  • mainline defaults to 1 unconditionally. SM computed 1 for merges to dev, else 2 — from a trial-and-error fix ("Fix mainline maybe", June 2024). For a standard GitHub merge commit, parent 1 is always the base-branch side, so -m 1 replays exactly the PR's changes for any base branch. The else 2 path was never exercised (all SM backports were dev→main). Still overridable via input.
  • No third-party create-json action — config written with a plain run step.
  • The merged+labeled guard lives in the reusable job, so callers stay thin and can't forget it.
  • commitConflicts is a real boolean instead of the string "true".

Inputs (target_pr_labels, auto_backport_label_prefix, mainline, pr_title) default to SM's current values.

Callers (merge after this — they reference @main): StabilityMatrix#1674, Lykos.Chat.Api#33, Lykos.Chat.Web#20.

🤖 Generated with Claude Code

Lifted from StabilityMatrix's backport.yml so any org repo can adopt
label-driven backports with a 3-line caller. Differences from the SM
original:

- mainline defaults to 1 unconditionally (the base-branch parent of a
  GitHub merge commit), replacing the branch-name-conditional 1/2 logic
  whose else-branch was never exercised; overridable via input
- config JSON written with a plain run step instead of the third-party
  jsdaniell/create-json action
- merged+labeled guard lives in the reusable job so callers stay thin
- optional 'token' secret for a future PAT/App token upgrade so backport
  PRs can trigger CI

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@gemini-code-assist

Copy link
Copy Markdown

Note

Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported.

Adds optional GitHub App authentication for backport PRs. When the org
variable BACKPORT_APP_ID and secret BACKPORT_APP_PRIVATE_KEY are present
(reached via the caller's `secrets: inherit`), the workflow mints an
installation token so backport PRs carry the App's name/avatar and
trigger CI — the two things GITHUB_TOKEN can't do. Skips cleanly and
falls back to GITHUB_TOKEN when the App isn't set up, so callers work
either way.

Replaces the earlier ad-hoc `token` secret input, which is superseded by
the App path.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ionite34 ionite34 merged commit c55406a into main Jul 4, 2026
@ionite34 ionite34 deleted the feat/reusable-backport-workflow branch July 4, 2026 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants