Trigger backport PR job on merge, not just label-added - #3292
Conversation
Previously the backport workflow only ran on the pull_request `labeled` event, so adding a `backport/*` label before a PR merged caused the job to fail (tibdex/backport requires a merged PR) with no retry once the merge actually happened. Add `closed` as a trigger type and gate the job on `pull_request.merged` so a pre-existing backport label is picked up at merge time as well. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
🎯 Code Coverage (details) 🔗 Commit SHA: 6d6e3a6 | Docs | Datadog PR Page | Give us feedback! |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f749d169ce
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if: > | ||
| (github.event_name == 'workflow_dispatch' || | ||
| (github.event.pull_request.merged && | ||
| (github.event.action == 'closed' || |
There was a problem hiding this comment.
Gate closed events on backport labels
When any merged PR is closed without a backport/* label but has a milestone, this new closed branch now runs the whole job. tibdex/backport no-ops and sets created_pull_requests to {} when no labels match, but the following github-script step still parses that output, gets undefined from Object.values(backportData)[0], and calls issues.update without an issue_number, so ordinary merged PRs with milestones will leave the Backport PR workflow failing. Please either require a matching backport label on the closed path or skip the milestone-copy step when no PR was created.
Useful? React with 👍 / 👎.
tibdex/backport no-ops on merged PRs without a matching backport label, leaving created_pull_requests empty. The milestone-copy step would then call issues.update with an undefined issue number and fail the job.
What does this PR do?
Adjusts
.github/workflows/backport-pr.ymlso abackportlabel applied before a PR is merged still results in a backport PR being created.closedalongsidelabeledto thepull_requesttrigger types.ifongithub.event.pull_request.merged, accepting either aclosedevent or alabeledevent carrying abackport/*label.Motivation
Today the job only runs on the
labeledevent. If a maintainer adds abackport/*label before the PR merges, the job fires immediately, buttibdex/backportrequires the PR to already be merged and fails. Nothing re-triggers it once the merge actually happens, so the backport silently never gets created unless someone re-adds the label after merge.Aligns the Operator backport process with the Agent backport process to avoid confusion for developers.
Checklist
bug,enhancement,refactoring,documentation,tooling, and/ordependenciesqa/skip-qalabel