Chore(ci): run backports on push and commit them under the sign-off
Description of your changes
Same change as kubevela/kubevela#7586, applied to this repo's backport workflow.
1. Run on push instead of pull_request_target. GitHub blocks pull_request_target by default in public repositories from 2026-12-02, with brownouts before then; a blocked run never starts, so the backport is silently skipped (kubevela/kubevela#7589 lost its backport this way on 2026-11-16). The workflow now triggers on the push of the merge commit to main or release-*, looks up the pull request merged into that branch as that commit, and, if it carries a backport ... label, hands it to backport-action via source_pr_number. Matching the base branch keeps a new release branch, created at an already-merged commit, from backporting that PR again. A push to this repo gets a writable GITHUB_TOKEN, and nothing from the fork is checked out.
2. Commit backports under the merged commit's sign-off. A squash merge records the author under their GitHub commit email (a noreply address when they keep it private), while the carried-over Signed-off-by: uses another. The bot's cherry-pick then has a sign-off matching neither its author nor its github-actions[bot] committer, and DCO fails. The committer is now taken from the merged commit's first valid Signed-off-by (Name <email>), falling back to the github-actions[bot] account.
3. Moves to korthout/backport-action v4.7.0, pinned by SHA (was the floating @v3 tag), for source_pr_number and the committer inputs. v4's only breaking change is Node 24, which GitHub-hosted runners have.
4. /backport comment command. It needs write access instead of read, so a commenter without it fails at the command step, before the label or the PR. It moves from zeebe-io/backport-action@v0.0.8 to the same v4.7.0 pin with the same sign-off committer step, so comment backports pass DCO too. The label step now awaits github.rest.issues.addLabels; github.issues does not exist in github-script v7, so it threw on every valid command. The job also declares the contents, pull-requests and issues write permissions it uses.
I have:
- Read and followed KubeVela's contribution process.
- Related Docs updated properly. Not applicable: CI only.
- Run
make reviewableto ensure this PR is ready for review. Not applicable: workflow files only. - Added
backport release-x.ylabels to auto-backport this PR if necessary. Not needed: backports start from merges to main, which run main's copy.
How has this code been tested
The steps were tested in kubevela/kubevela#7586, run as they sit in the YAML under bash -eo pipefail against real kubevela commits: a labelled merge resolves to its PR number, an unlabelled one is skipped, the same commit pushed as a new release branch is skipped, a commit that is no PR's merge commit exits 0, and the sign-off parser falls back on missing or malformed lines. back-port here differs only in main for master. Not yet tested end to end; that needs a labelled squash merge.
Special notes for your reviewer
- The sign-off text comes from commit messages, so it is untrusted; it only reaches the action's
with:inputs, never arun:script, and must matchName <email>first. - The job now declares
contents: writeandpull-requests: writeexplicitly instead of relying on the repo's default token permissions.