Skip to content

Commit b8789dc

Browse files
authored
Update trigger-test.yml
1 parent d2c3c32 commit b8789dc

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

.github/workflows/trigger-test.yml

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,40 @@ jobs:
77
trigger:
88
runs-on: ubuntu-latest
99
steps:
10+
- name: Extract semver tag
11+
id: semver
12+
run: |
13+
REF_NAME="${{ github.ref_name }}"
14+
# Check if ref matches semver pattern (e.g., v1.2.3 or 1.2.3)
15+
if [[ "$REF_NAME" =~ ^v?[0-9]+\.[0-9]+\.[0-9]+.*$ ]]; then
16+
echo "semver=$REF_NAME" >> $GITHUB_OUTPUT
17+
echo "is_semver=true" >> $GITHUB_OUTPUT
18+
else
19+
echo "semver=" >> $GITHUB_OUTPUT
20+
echo "is_semver=false" >> $GITHUB_OUTPUT
21+
fi
22+
1023
- name: Trigger private repo workflow
1124
run: |
1225
curl -L \
1326
-X POST \
1427
-H "Accept: application/vnd.github+json" \
1528
-H "Authorization: Bearer ${{ secrets.PRIVATE_REPO_PAT }}" \
1629
-H "X-GitHub-Api-Version: 2022-11-28" \
17-
https://api.github.com/repos/locusrobotics/locus_orbbec_ros2/dispatches \
18-
-d '{"event_type":"trigger-from-public","client_payload":{"param1":"value1","param2":"value2"}}'
30+
https://api.github.com/repos/YOUR_ORG/PRIVATE_REPO/dispatches \
31+
-d '{
32+
"event_type":"trigger-from-public",
33+
"client_payload":{
34+
"origin_repo":"${{ github.repository }}",
35+
"origin_repo_url":"${{ github.repositoryUrl }}",
36+
"ref":"${{ github.ref }}",
37+
"ref_name":"${{ github.ref_name }}",
38+
"ref_type":"${{ github.ref_type }}",
39+
"semver":"${{ steps.semver.outputs.semver }}",
40+
"is_semver":"${{ steps.semver.outputs.is_semver }}",
41+
"sha":"${{ github.sha }}",
42+
"event_name":"${{ github.event_name }}",
43+
"actor":"${{ github.actor }}",
44+
"pr_number":"${{ github.event.pull_request.number }}"
45+
}
46+
}'

0 commit comments

Comments
 (0)