Update trigger-test.yml #3
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Trigger Private Repo | |
| on: | |
| push: | |
| pull_request: | |
| jobs: | |
| trigger: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Extract semver tag | |
| id: semver | |
| run: | | |
| REF_NAME="${{ github.ref_name }}" | |
| # Check if ref matches semver pattern (e.g., v1.2.3 or 1.2.3) | |
| if [[ "$REF_NAME" =~ ^v?[0-9]+\.[0-9]+\.[0-9]+.*$ ]]; then | |
| echo "semver=$REF_NAME" >> $GITHUB_OUTPUT | |
| echo "is_semver=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "semver=" >> $GITHUB_OUTPUT | |
| echo "is_semver=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Trigger private repo workflow | |
| run: | | |
| curl -L \ | |
| -X POST \ | |
| -H "Accept: application/vnd.github+json" \ | |
| -H "Authorization: Bearer ${{ secrets.PRIVATE_REPO_PAT }}" \ | |
| -H "X-GitHub-Api-Version: 2022-11-28" \ | |
| https://api.github.com/repos/YOUR_ORG/PRIVATE_REPO/dispatches \ | |
| -d '{ | |
| "event_type":"trigger-from-public", | |
| "client_payload":{ | |
| "origin_repo":"${{ github.repository }}", | |
| "origin_repo_url":"${{ github.repositoryUrl }}", | |
| "ref":"${{ github.ref }}", | |
| "ref_name":"${{ github.ref_name }}", | |
| "ref_type":"${{ github.ref_type }}", | |
| "semver":"${{ steps.semver.outputs.semver }}", | |
| "is_semver":"${{ steps.semver.outputs.is_semver }}", | |
| "sha":"${{ github.sha }}", | |
| "event_name":"${{ github.event_name }}", | |
| "actor":"${{ github.actor }}", | |
| "pr_number":"${{ github.event.pull_request.number }}" | |
| } | |
| }' |