-
Notifications
You must be signed in to change notification settings - Fork 29
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
Feature request : backport to all open feature branches #343
Comments
Hi @RupertBarrow 👋 That's a great request! ✅ You can use the Note that the name: Backport to all feature branches
on:
pull_request_target:
types: [closed]
permissions:
contents: write # so it can comment
pull-requests: write # so it can create pull requests
jobs:
backport:
name: Open backport pull requests
runs-on: ubuntu-latest
# Don't run on closed unmerged pull requests
if: github.event.pull_request.merged
steps:
- uses: actions/checkout@v3
with:
# Fetch all branches
fetch-depth: 0
- id: branches
shell: bash
# list all banches, filtering for 'feature/*', and cutting off remotes/origin/
# then finally substitute newlines for spaces
run: |
branches=$(git branch --list --all | grep 'origin/feature/' | cut -c 18- )
space_delimited=${branches//$'\n'/ }
echo "BRANCHES=${space_delimited}" >> $GITHUB_OUTPUT
- uses: korthout/backport-action@v1
with:
# now you can use the branches output in the backport-action
target_branches: ${{ steps.branches.outputs.BRANCHES }} Tested with an example workflow
Example run, using workflow: name: Space delimit branches
on:
workflow_dispatch: {}
jobs:
branches:
name: Space delimited branches
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- id: branches
shell: bash
run: |
branches=$(git branch --list --all | grep 'origin/stable/' | cut -c 18- )
space_delimited=${branches//$'\n'/ }
echo "BRANCHES=${space_delimited}" >> $GITHUB_OUTPUT
- run: echo "${{ steps.branches.outputs.BRANCHES }}" |
Wow, thanks for the quick turnaround and the detailed response ! Thanks for the solution : I will try it out and tell you how it goes ! |
Hi @korthout ,
|
Hi @RupertBarrow Thanks for sharing the logs, it helps a lot in troubleshooting this. 🏗️ Let's see if we can get it to work as you expect.
|
Thanks, again, for your quick answers.
|
I'm happy to try and get this working for you 👍 I'm convinced we can.
Here you can see the cherry-pick not being able to apply the changes due to a conflict:
Hope this helps 🙇 |
I thought a bit more about the problem you're facing, and I see two ways the action can help support this better:
I'll re-open this issue to track this. |
@RupertBarrow I've resolved the first of these two with #344, which is now available on versions To support glob patterns in |
It would be nice to be able to backport to all feature branches currently open named eg 'feature/*'.
The configuration would be something like:
for example.
This would create a PR on each feature/* branch.
The text was updated successfully, but these errors were encountered: