Skip to content

Output the list of created PRs #161

@v1v

Description

@v1v

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/backport-github-action@v9.5.1
        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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions