Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dispach trigger for internal test #1545

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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\"}}"
Loading