Skip to content

Chore(ci): run backports on push and commit them under the sign-off - #288

Open
briankane wants to merge 3 commits into
kubevela:mainfrom
briankane:ci/backport-on-push
Open

briankane wants to merge 3 commits into
kubevela:mainfrom
briankane:ci/backport-on-push

Conversation

@briankane

@briankane briankane commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

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 reviewable to ensure this PR is ready for review. Not applicable: workflow files only.
  • Added backport release-x.y labels 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 a run: script, and must match Name <email> first.
  • The job now declares contents: write and pull-requests: write explicitly instead of relying on the repo's default token permissions.

GitHub blocks pull_request_target by default in public repositories from
2026-12-02, with brownouts before then, and a blocked Backport run never
starts. Trigger on the push of the merge commit to main or release-*,
find the pull request merged as that commit, and hand it to
backport-action via source_pr_number when it carries a backport label.

Take the backport's committer from the merged commit's first valid
Signed-off-by, so the DCO check matches it when a squash merge records
the author under a different (noreply) email. Falls back to the
github-actions[bot] account.

Moves to korthout/backport-action v4.7.0, pinned by SHA, for
source_pr_number and the committer inputs; v4's only breaking change is
Node 24. Same change as kubevela/kubevela#7586.

Signed-off-by: Brian Kane <briankane1@gmail.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 1 file

Reply with feedback, questions, or to request a fix.

View guided diff | Re-trigger cubic

Comment thread .github/workflows/back-port.yaml Resolved
@codecov

codecov Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.31%. Comparing base (d7db9c4) to head (9de4b13).
⚠️ Report is 52 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main     #288       +/-   ##
===========================================
+ Coverage   62.49%   80.31%   +17.82%     
===========================================
  Files          62       88       +26     
  Lines        4415     7040     +2625     
===========================================
+ Hits         2759     5654     +2895     
- Misses       1324     1386       +62     
+ Partials      332        0      -332     
Flag Coverage Δ
e2etests 37.51% <ø> (?)
unit-test 74.70% <ø> (+12.21%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@anoop2811 anoop2811 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Brian. I had #292 open for the same problem and have closed it in favour of this.

Two things while you're here:

  1. issue-commands.yml in this repo still pins backport-action v0.0.8 for the /backport comment command, so the sign-off fix won't apply when someone backports by comment. Do you want to bump it in this PR as well?

  2. That command runs with permission-level: read, so on a public repo anyone can trigger it. Could you change it to write at the same time?

I've added the same Actions policy here as on kubevela/kubevela: it allows push, issue_comment and pull_request_target for back-port.yaml, so the push trigger won't be blocked after Dec 2.

…ackport

Only take a pull request merged into the pushed branch, so creating a
release branch at an already-merged commit does not backport that PR
again. No sleep after the last lookup attempt.

Require write access for /backport: with read, anyone could comment it on a
merged PR to add a label and open a backport. The comment command moves to
backport-action v4.7.0 with the same sign-off committer as back-port, awaits
github.rest.issues.addLabels, and the job declares the permissions it uses.

Signed-off-by: Brian Kane <briankane1@gmail.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 2 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

View guided diff | Re-trigger cubic

Comment thread .github/workflows/back-port.yaml Resolved
Comment thread .github/workflows/back-port.yaml Resolved
@briankane

Copy link
Copy Markdown
Member Author

Thanks. Both done in e9583ae: /backport needs write access, and it now uses backport-action v4.7.0 with the same sign-off committer as the push workflow.

While I was in there: the label step called github.issues.addLabels, which doesn't exist in github-script v7 (it's github.rest.issues), so it would have thrown on every valid /backport. That's fixed too, and the job now declares the write permissions it needs.

Signed-off-by: Brian Kane <briankane1@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/ci GitHub Actions, releases and backports priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. type/ci CI/CD workflow or pipeline changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants