|
| 1 | +--- |
| 2 | +name: Backport merged pull request |
| 3 | + |
| 4 | +on: |
| 5 | + pull_request_target: |
| 6 | + types: [labeled] |
| 7 | + |
| 8 | +permissions: {} |
| 9 | + |
| 10 | +env: |
| 11 | + GIT_AUTHOR_NAME: OpenVoxProjectBot |
| 12 | + GIT_AUTHOR_EMAIL: 215568489+OpenVoxProjectBot@users.noreply.github.com |
| 13 | + GIT_COMMITTER_NAME: OpenVoxProjectBot |
| 14 | + GIT_COMMITTER_EMAIL: 215568489+OpenVoxProjectBot@users.noreply.github.com |
| 15 | + SSH_AUTH_SOCK: /tmp/ssh_agent.sock |
| 16 | + |
| 17 | +jobs: |
| 18 | + backport: |
| 19 | + name: Backport merged pull request |
| 20 | + runs-on: ubuntu-latest |
| 21 | + # For security reasons, we don't want to checkout and run arbitrary code when |
| 22 | + # using the pull_request_target trigger. So restrict this to cases where the |
| 23 | + # backport label is applied to an already merged PR. |
| 24 | + if: github.event.pull_request.merged && contains(github.event.label.name, 'backport') |
| 25 | + steps: |
| 26 | + - name: Add SSH key |
| 27 | + run: | |
| 28 | + mkdir -p ~/.ssh |
| 29 | + echo "${{ secrets.OPENVOXBOT_SSH_PRIVATE_KEY }}" > ~/.ssh/github_actions |
| 30 | + chmod 600 ~/.ssh/github_actions |
| 31 | + ssh-agent -a $SSH_AUTH_SOCK > /dev/null |
| 32 | + ssh-add ~/.ssh/github_actions |
| 33 | +
|
| 34 | + - name: Setup git |
| 35 | + run: | |
| 36 | + git config --global user.email "$GIT_AUTHOR_EMAIL" |
| 37 | + git config --global user.name "$GIT_AUTHOR_NAME" |
| 38 | + git config --global gpg.format ssh |
| 39 | + git config --global user.signingkey ~/.ssh/github_actions |
| 40 | + git config --global commit.gpgsign true |
| 41 | + git config --global tag.gpgsign true |
| 42 | + - name: Checkout repository |
| 43 | + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 |
| 44 | + with: |
| 45 | + token: ${{ secrets.OPENVOXBOT_COMMIT_AND_PRS }} |
| 46 | + ref: main |
| 47 | + - name: Create backport pull requests |
| 48 | + uses: korthout/backport-action@2e830a1d0b8269505846ddd407a70876913ad1f8 # v4.6.0 |
| 49 | + with: |
| 50 | + auto_merge_enabled: true |
| 51 | + auto_merge_method: merge |
| 52 | + github_token: ${{ secrets.OPENVOXBOT_COMMIT_AND_PRS }} |
| 53 | + git_committer_name: OpenVoxProjectBot |
| 54 | + git_committer_email: 215568489+OpenVoxProjectBot@users.noreply.github.com |
0 commit comments