|
5 | 5 | types: [created] |
6 | 6 |
|
7 | 7 | jobs: |
8 | | - launchBackportBuild: |
| 8 | + setupBackport: |
9 | 9 | runs-on: ubuntu-latest |
10 | | - if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '@gitbot') |
11 | | - |
| 10 | + if: github.event.issue.pull_request != '' && startswith(github.event.comment.body, '@gitbot backport') |
| 11 | + outputs: |
| 12 | + target_branch: ${{ steps.parse_comment.outputs.target_branch }} |
12 | 13 | steps: |
13 | | - |
14 | | - with: |
15 | | - pull_request_url: ${{ github.event.issue.pull_request.url }} |
16 | | - comment_body: ${{ github.event.comment.body }} |
17 | | - comment_author: ${{ github.actor }} |
18 | | - github_repository: ${{ github.repository }} |
19 | | - ado_organization: ${{ secrets.ADO_PROJECTCOLLECTION }} |
20 | | - ado_project: ${{ secrets.ADO_PROJECT }} |
21 | | - backport_pipeline_id: ${{ secrets.BACKPORT_PIPELINEID }} |
22 | | - ado_build_pat: ${{ secrets.ADO_BUILDPAT }} |
23 | | - github_account_pat: ${{ secrets.SERVICEACCOUNT_PAT }} |
24 | | - use_fork: 'false' |
| 14 | + - name: Parse Comment |
| 15 | + id: parse_comment |
| 16 | + run: | |
| 17 | + Write-Host "Parsing $env:COMMENT" |
| 18 | + ($botName, $backport, $backportTargetBranch) = [System.Text.RegularExpressions.Regex]::Split("$env:COMMENT", "\s+") |
| 19 | + echo "::set-output name=target_branch::$backportTargetBranch" |
| 20 | + shell: pwsh |
| 21 | + env: |
| 22 | + COMMENT: "${{ github.event.comment.body }}" |
| 23 | + |
| 24 | + launchBackportBuild: |
| 25 | + needs: setupBackport |
| 26 | + uses: xamarin/backport-bot-action/.github/workflows/[email protected] |
| 27 | + with: |
| 28 | + pull_request_url: ${{ github.event.issue.pull_request.url }} |
| 29 | + target_branch: ${{ needs.setupBackport.outputs.target_branch }} |
| 30 | + comment_author: ${{ github.actor }} |
| 31 | + github_repository: ${{ github.repository }} |
| 32 | + use_fork: false |
| 33 | + secrets: |
| 34 | + ado_organization: ${{ secrets.ADO_PROJECTCOLLECTION }} |
| 35 | + ado_project: ${{ secrets.ADO_PROJECT }} |
| 36 | + backport_pipeline_id: ${{ secrets.BACKPORT_PIPELINEID }} |
| 37 | + ado_build_pat: ${{ secrets.ADO_BUILDPAT }} |
| 38 | + github_account_pat: ${{ secrets.SERVICEACCOUNT_PAT }} |
0 commit comments