mirror of
https://github.com/n8n-io/n8n
synced 2026-04-21 15:47:20 +00:00
83 lines
2.9 KiB
YAML
83 lines
2.9 KiB
YAML
name: 'Util: Backport pull request changes'
|
|
|
|
run-name: Backport pull request ${{ github.event.pull_request.number || inputs.pull-request-id }}
|
|
|
|
on:
|
|
pull_request:
|
|
types: [closed]
|
|
workflow_dispatch:
|
|
inputs:
|
|
pull-request-id:
|
|
description: 'The ID number of the pull request (e.g. 3342). No #, no extra letters.'
|
|
required: true
|
|
type: string
|
|
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
|
|
jobs:
|
|
backport:
|
|
if: |
|
|
github.event.pull_request.merged == true ||
|
|
github.event_name == 'workflow_dispatch'
|
|
runs-on: ubuntu-slim
|
|
steps:
|
|
- name: Generate GitHub App Token
|
|
id: generate-token
|
|
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
|
|
with:
|
|
app-id: ${{ secrets.N8N_ASSISTANT_APP_ID }}
|
|
private-key: ${{ secrets.N8N_ASSISTANT_PRIVATE_KEY }}
|
|
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
token: ${{ steps.generate-token.outputs.token }}
|
|
fetch-depth: 0
|
|
|
|
- name: Setup Node.js
|
|
uses: ./.github/actions/setup-nodejs
|
|
with:
|
|
build-command: ''
|
|
install-command: pnpm install --frozen-lockfile --dir ./.github/scripts --ignore-workspace
|
|
|
|
- name: Compute backport targets
|
|
id: targets
|
|
env:
|
|
PULL_REQUEST_ID: ${{ inputs.pull-request-id }}
|
|
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
|
|
run: node .github/scripts/compute-backport-targets.mjs
|
|
|
|
- name: Backport
|
|
if: steps.targets.outputs.target_branches != ''
|
|
uses: korthout/backport-action@4aaf0e03a94ff0a619c9a511b61aeb42adea5b02 # v4.2.0
|
|
with:
|
|
github_token: ${{ steps.generate-token.outputs.token }}
|
|
source_pr_number: ${{ github.event.pull_request.number || inputs.pull-request-id }}
|
|
target_branches: ${{ steps.targets.outputs.target_branches }}
|
|
pull_description: |-
|
|
# Description
|
|
Backport of #${pull_number} to `${target_branch}`.
|
|
|
|
## Checklist for the author (@${pull_author}) to go through.
|
|
|
|
- [ ] Review the backport changes
|
|
- [ ] Fix possible conflicts
|
|
- [ ] Merge to target branch
|
|
|
|
After this PR has been merged, it will be picked up in the next patch release for release track.
|
|
|
|
# Original description
|
|
|
|
${pull_description}
|
|
pull_title: ${pull_title} (backport to ${target_branch})
|
|
add_author_as_assignee: true
|
|
add_author_as_reviewer: true
|
|
copy_assignees: true
|
|
copy_requested_reviewers: false
|
|
copy_labels_pattern: '^(?!Backport to\b).+' # Copy everything except backport labels
|
|
add_labels: 'automation:backport'
|
|
experimental: >
|
|
{
|
|
"conflict_resolution": "draft_commit_conflicts"
|
|
}
|