Skip to content
name: Trigger Target Workflow
on:
push:
branches:
- develop
paths:
- 'doc/man1/**'
- 'doc/man7/**'
jobs:
trigger:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Trigger Workflow in Another Repository
run: |
# Set the required variables
repo_owner="mattsmida"
repo_name="ti.net"
event_type="trigger-workflow"
service="the-push-service"
version="v0.0.3"
# Get the list of changed filenames
changed_filenames=$(git -C $GITHUB_WORKSPACE diff --name-only HEAD~1)
# Base64 encode the changed files to send
encoded_file_contents=$(base64 $changed_filenames | tr -d \'n')
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.PAT }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/$repo_owner/$repo_name/dispatches \
-d '{\"event_type\": \"$event_type\", \"client_payload\": {\"service\": \"$service\", \"version\": \"$version\", \"unit\": false, \"integration\": true, \"changed_filenames\": \"$changed_filenames\", \"encoded_file_contents\": \"$encoded_file_contents\"}}'