Skip to content
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

Support glob patterns in target_branches input #349

Open
korthout opened this issue Jun 8, 2023 · 0 comments
Open

Support glob patterns in target_branches input #349

korthout opened this issue Jun 8, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@korthout
Copy link
Owner

korthout commented Jun 8, 2023

Some users want to automatically backport a pull request to a dynamically defined set of target branches.

For example, in #343 the request was to backport to all branches matching the feature/* pattern.

A workaround is available by adding an additional step in the workflow to expand the pattern into the branch refs:

- 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 }}

However, it would be great to support this directly in the target_branches input as:

- uses: actions/checkout@v3
  with:
    # Fetch all branches
    fetch-depth: 0
- uses: korthout/backport-action@v1
  with:
    target_branches: 'feature/*'

Note that a deep checkout (fetch-depth:0) is required to fetch all branches.

@korthout korthout added the enhancement New feature or request label Jun 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant