summaryrefslogtreecommitdiff
path: root/.github/workflows/trigger-pr-mirror-repo-sync.yml
blob: 9653c2dcadb3a1c15b9b962e39c843bd4f3946b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
name: Trigger Mirror PR and Repo Sync
on:
  pull_request_target:
      types:
        - closed
      branches:
        - current

env:
  GH_TOKEN: ${{ secrets.PAT }}

concurrency:
  group: trigger-pr-mirror-repo-sync-${{ github.event.pull_request.base.ref }}
  cancel-in-progress: false
jobs:
  trigger-mirror-pr-repo-sync:
    if: ${{ github.repository_owner == 'vyos' }}
    runs-on: ubuntu-latest
    permissions:
      pull-requests: write
      contents: write

    steps:
    - name: Bullfrog Secure Runner
      uses: bullfrogsec/bullfrog@v0
      with:
        egress-policy: audit

    - name: Trigger repo sync
      shell: bash
      run: |
        echo "Triggering sync workflow for ${{ secrets.REMOTE_OWNER }}/${{ secrets.REMOTE_REPO }}"
        echo "Triggering sync workflow with PAT ${{ secrets.PAT }}"
        curl -X POST \
          -H "Accept: application/vnd.github.everest-preview+json" \
          -H "Authorization: Bearer ${{ secrets.PAT }}" \
          https://api.github.com/repos/${{ secrets.REMOTE_OWNER }}/${{ secrets.REMOTE_REPO }}/actions/workflows/mirror-pr-and-sync.yml/dispatches \
          -d '{"ref":"git-actions", "inputs": {"pr_number": "${{  github.event.pull_request.number }}", "sync_branch": "${{ github.event.pull_request.base.ref }}"}}'