Add triggers based on Github PR labels

@cathy.harmon @ahvth-bitrise

is there any update on this feature? we’d love to trigger builds via adding a label to a specific PR, rather than every single pull request

I’d love this feature if available, jakarta barat
best regards

for the time being, I’ve created a GH Action to implement this feature. hopefully this helps anyone looking for this feature for now.

name: Check for Bitrise Label

on:
  pull_request:
    types: [labeled, synchronize]

jobs:
  deploy:
    name: Trigger Build with Label
    runs-on: ubuntu-16.04

    steps:
      - name: Get the pull request number
        id: pr_number
        run: |
          echo ::set-output name=number::$(echo "$GITHUB_REF" | awk -F / '{print $3}')
      - name: Send mobile build on bitrise
        if: contains(github.event.pull_request.labels.*.name, 'Build Bitrise')
        run: |
          curl https://app.bitrise.io/app/YOUR_APP_ID/build/start.json --data '{
            "hook_info":{
              "type":"bitrise",
              "build_trigger_token":"YOUR_BUILD_TOKEN"
            },
            "build_params":{
              "branch":"${{ github.head_ref }}",
              "workflow_id":"deploy-internal",
              "commit_hash":"${{ github.event.pull_request.head.sha }}",
              "pull_request_id": ${{ steps.pr_number.outputs.number }}
            },
            "triggered_by":"curl"
          }'
5 Likes

Hey @jasonatcompanycam
Appreciate for GA action approach, Can you hep me on this?

tried with few changes on your suggestion but not sucessed.

name: Trigger Squad build

on:
  pull_request:
    types: [labeled, synchronize]

jobs:
  deploy:
    name: Trigger Build with Label
    runs-on: osx-xcode-14.2.x-ventura

    steps:
      - name: Get the pull request number
        id: pr_number
        run: |
          echo ::set-output name=number::$(echo "$GITHUB_REF" | awk -F / '{print $3}')
      - name: Send mobile build on bitrise
        if: contains(github.event.pull_request.labels.*.name, 'Trigger squad build')
        run: |
            curl -X 'POST' \ '
              https://api.bitrise.io/v0.1/apps/{app-slug}/builds' \ 
              -H 'accept: application/json' \
              -H 'Authorization: MY_ACCESS_TOKEN' \
              -H 'Content-Type: application/json' \
              -d '{
              "hook_info":{
                "type":"bitrise"
              },
              "build_params": {
                "branch":"${{ github.head_ref }}",
                "workflow_id":"SQUAD_QC_BUILD",
                "commit_hash":"${{ github.event.pull_request.head.sha }}",
                "pull_request_id": ${{ steps.pr_number.outputs.number }}
              }
            "triggered_by": "curl"
            }'

Can you confirm this API still working for you?
curl https://app.bitrise.io/app/YOUR_APP_ID/build/start.json --data '{

Pleased to share that Bitrise relesed PR-label based triggers earlier this year. Check this our - Triggering builds automatically - Bitrise Docs