-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add dispach trigger for internal test
- Loading branch information
1 parent
ccf393a
commit 256e94c
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
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\"}}" |