|
| 1 | +--- |
| 2 | +name: Fork PR dispatch to enterprise |
| 3 | +on: |
| 4 | + workflow_run: |
| 5 | + workflows: ["PR verification (forks)"] |
| 6 | + types: [completed] |
| 7 | +permissions: |
| 8 | + id-token: write |
| 9 | + contents: read |
| 10 | + statuses: write |
| 11 | +jobs: |
| 12 | + dispatch: |
| 13 | + if: > |
| 14 | + github.event.workflow_run.conclusion == 'success' && |
| 15 | + github.event.workflow_run.event == 'pull_request' && |
| 16 | + github.event.workflow_run.head_repository.fork == true |
| 17 | + runs-on: blacksmith-2vcpu-ubuntu-2404 |
| 18 | + steps: |
| 19 | + - uses: aws-actions/configure-aws-credentials@v4 |
| 20 | + with: |
| 21 | + aws-region: ${{ vars.RP_AWS_CRED_REGION }} |
| 22 | + role-to-assume: arn:aws:iam::${{ secrets.RP_AWS_CRED_ACCOUNT_ID }}:role/${{ vars.RP_AWS_CRED_BASE_ROLE_NAME }}${{ github.event.repository.name }} |
| 23 | + - uses: aws-actions/aws-secretsmanager-get-secrets@v2 |
| 24 | + with: |
| 25 | + secret-ids: | |
| 26 | + ,sdlc/prod/github/actions_bot_token |
| 27 | + parse-json-secrets: true |
| 28 | + - name: Build dispatch payload |
| 29 | + id: payload |
| 30 | + env: |
| 31 | + HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }} |
| 32 | + HEAD_SHA: ${{ github.event.workflow_run.head_sha }} |
| 33 | + HEAD_REPO: ${{ github.event.workflow_run.head_repository.full_name }} |
| 34 | + uses: actions/github-script@v7 |
| 35 | + with: |
| 36 | + script: | |
| 37 | + const payload = { |
| 38 | + branch: process.env.HEAD_BRANCH, |
| 39 | + commit_sha: process.env.HEAD_SHA, |
| 40 | + head_repository: process.env.HEAD_REPO, |
| 41 | + is_fork: true, |
| 42 | + }; |
| 43 | + core.setOutput('json', JSON.stringify(payload)); |
| 44 | + core.setOutput('sha', process.env.HEAD_SHA); |
| 45 | + - name: Repository dispatch for fork PR |
| 46 | + uses: peter-evans/repository-dispatch@caebe2a7c967e9f927ff8780fea8e16e50b5ce40 |
| 47 | + with: |
| 48 | + token: ${{ env.ACTIONS_BOT_TOKEN }} |
| 49 | + repository: redpanda-data/console-enterprise |
| 50 | + event-type: push |
| 51 | + client-payload: ${{ steps.payload.outputs.json }} |
| 52 | + - name: Set pending enterprise CI status |
| 53 | + env: |
| 54 | + HEAD_SHA: ${{ steps.payload.outputs.sha }} |
| 55 | + uses: actions/github-script@v7 |
| 56 | + with: |
| 57 | + github-token: ${{ env.ACTIONS_BOT_TOKEN }} |
| 58 | + script: | |
| 59 | + await github.rest.repos.createCommitStatus({ |
| 60 | + owner: 'redpanda-data', |
| 61 | + repo: 'console', |
| 62 | + sha: process.env.HEAD_SHA, |
| 63 | + state: 'pending', |
| 64 | + description: 'Enterprise CI is running...', |
| 65 | + context: 'Enterprise CI' |
| 66 | + }); |
0 commit comments