-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for dynamic targetPRLabels
#391
Comments
This is a great idea. Using the regex placeholder ( I've been thinking about adding support for a js-based config file (in addition to the current json-based one). // .backportrc.js
module.exports = {
targetPRLabels: (sourceCommit, targetBranch, sourcePRLabel) => {
const match = sourceLabel.match(/(.*)-todo$/)?.[1];
if (match) {
return [match]
}
}
} Do you have any preferences? |
I agree that using |
fyi: I've created #400 to support dynamic target labels like you suggested |
@jumaffre Support for dynamic I haven't bumped the github action yet. If you want to try it out, please specify
Please let me know if it works as expected. if it does I'll release the Github action |
@sqren This is working as expected. Thank you very much for sorting this out so quickly. Separately to this, the following error occurred when I tried this new feature and tagged the same PR with two separate tags: https://github.com/microsoft/CCF/runs/7029861991?check_suite_focus=true. Could this be because our flow is a little different (we checkout the repository explicitly to avoid merge conflicts on a well-known file)? |
Ouch, that looks bad. I don't know why multiple processes would run simultaneously and cause this. I'll try to see if I can reproduce. |
@jumaffre I haven't been able to repro even when using your workflow file. Does the problem happen consistently for you or intermittently? |
As far as I can see from the documentation and examples out there, the specified
targetPRLabels
is always static (typically set to["backport"]
). However, in some cases, it would be useful to be able to specify a dynamic label to add to the backport PR, e.g. to include the major version of the branch this PR is backported to.For example, based on the existing
branchLabelMapping
,targetPRLabels
could become:["$1-backport"]
.Please let me know if this use case makes sense and whether
backport
already supports such functionality. We've already been using this convention when manually backporting PRs to release branches and would like to continue doing so when automatising this process.The text was updated successfully, but these errors were encountered: