Skip to content

Commit

Permalink
Add dispach trigger for internal test
Browse files Browse the repository at this point in the history
  • Loading branch information
takanotaiga committed Mar 6, 2025
1 parent ccf393a commit 256e94c
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/dispatch-trigger.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Repository Dispatch Trigger

on:
workflow_dispatch:
pull_request:
branches: [ "master" ]
push:
branches: [ "master" ]

jobs:
trigger-repository-dispatch:
runs-on: ubuntu-latest
steps:
- name: Set Repository and Branch Info
id: set_repo_branch_info
run: |
echo "TARGET_REPOSITORY=${GITHUB_REPOSITORY}" >> $GITHUB_ENV
if [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then
echo "TARGET_BRANCH=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV
else
echo "TARGET_BRANCH=${GITHUB_SHA}" >> $GITHUB_ENV
fi
- name: Print Dispatch Data
run: |
echo "Dispatch Event Data:"
echo "Branch: ${{ env.TARGET_BRANCH }}"
echo "Repository: ${{ env.TARGET_REPOSITORY }}"
- name: Send Repository Dispatch Event
run: |
DISPATCH_OWNER=tier4
DISPATCH_REPOSITORY=context_gamma_planner
TARGET_BRANCH=${{ env.TARGET_BRANCH }}
TARGET_REPOSITORY=${{ env.TARGET_REPOSITORY }}
curl --fail \
-X POST \
-H "Authorization: token ${{ secrets.SECRET_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/$DISPATCH_OWNER/$DISPATCH_REPOSITORY/dispatches \
-d "{\"event_type\":\"on-demand-test\",\"client_payload\":{\"ref\":\"$TARGET_BRANCH\",\"repo\":\"$TARGET_REPOSITORY\"}}"

0 comments on commit 256e94c

Please sign in to comment.