backport-github-action icon indicating copy to clipboard operation
backport-github-action copied to clipboard

Output the list of created PRs

Open v1v opened this issue 1 year ago • 0 comments

As a user I want to know the list of GitHub PRs that have been created so I can do something else with them afterwards.


name: Automatic backport action

on:
  pull_request_target:
    types: ["labeled", "closed"]

jobs:
  backport:
    name: Backport PR
    if: github.event.pull_request.merged == true && !(contains(github.event.pull_request.labels.*.name, 'backport'))
    runs-on: ubuntu-latest
    outputs:
      pull-requests: ${{ steps.backport.outputs.pull-requests }}
    steps:
      - name: Backport Action
        id: backport
        uses: sorenlouv/[email protected]
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          auto_backport_label_prefix: backport-to-
...

  auto-approve:
    needs: backport
    runs-on: ubuntu-latest
    permissions:
      pull-requests: write
    steps:
    - uses: hmarr/auto-approve-action@v4
      with:
        # a matrix job will help, but I hope I can explain the idea
        pull-request-number: ${{ needs.backport.outputs.pull-requests  }}

That can be handy if I post-process the created PRs with something else using ${{ secrets.GITHUB_TOKEN }}, such as: enable the auto-approval

v1v avatar Sep 11 '24 10:09 v1v