|
| 1 | +name: Trigger ROCm CI |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: [opened, synchronize, reopened] |
| 6 | + branches: [release/rocm-rel-7.2] |
| 7 | + |
| 8 | +jobs: |
| 9 | + trigger-rocm-ci: |
| 10 | + runs-on: azure-vms |
| 11 | + steps: |
| 12 | + - name: Generate GitHub App token |
| 13 | + id: generate-token |
| 14 | + |
| 15 | + with: |
| 16 | + app-id: ${{ secrets.APP_ID }} |
| 17 | + private-key: ${{ secrets.APP_PRIVATE_KEY }} |
| 18 | + owner: ${{ secrets.INTERNAL_ORG }} |
| 19 | + repositories: ${{ secrets.INTERNAL_REPO }} |
| 20 | + |
| 21 | + - name: Trigger ROCm CI workflow |
| 22 | + env: |
| 23 | + TARGET_REPO: "${{ secrets.INTERNAL_ORG }}/${{ secrets.INTERNAL_REPO }}" |
| 24 | + GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} |
| 25 | + run: | |
| 26 | + echo "Triggering ROCm CI workflow" |
| 27 | + echo "PR Number: ${{ github.event.pull_request.number }}" |
| 28 | + |
| 29 | + response=$(curl -s -w "%{http_code}" -X POST \ |
| 30 | + -H "Accept: application/vnd.github+json" \ |
| 31 | + -H "Authorization: Bearer $GITHUB_TOKEN" \ |
| 32 | + -H "X-GitHub-Api-Version: 2022-11-28" \ |
| 33 | + https://api.github.com/repos/$TARGET_REPO/dispatches \ |
| 34 | + -d "{ |
| 35 | + \"event_type\": \"public-psdb-run\", |
| 36 | + \"client_payload\": { |
| 37 | + \"input_sha\": \"${{ github.event.pull_request.head.sha }}\", |
| 38 | + \"input_pr_num\": \"${{ github.event.pull_request.number }}\", |
| 39 | + \"input_pr_url\": \"${{ github.event.pull_request.html_url }}\", |
| 40 | + \"input_pr_title\": \"${{ github.event.pull_request.title }}\", |
| 41 | + \"repository_name\": \"${{ github.repository }}\", |
| 42 | + \"base_ref\": \"${{ github.event.pull_request.base.ref }}\", |
| 43 | + \"trigger_event_type\": \"pull_request\", |
| 44 | + \"comment_text\": \"\" |
| 45 | + } |
| 46 | + }") |
| 47 | + |
| 48 | + http_code="${response: -3}" |
| 49 | + if [ "$http_code" = "204" ]; then |
| 50 | + echo "Successfully triggered ROCm CI workflow" |
| 51 | + else |
| 52 | + echo "Failed to trigger ROCm CI workflow (HTTP $http_code)" |
| 53 | + exit 1 |
| 54 | + fi |
0 commit comments