GitHub Action
cross-repo-pipeline-trigger
v1.1
Latest version
The Cross Repository Pipeline Trigger Action is a GitHub Action that allows you to initiate a workflow in a different repository (target repo) and automatically post the workflow execution results in the original repository's pull request comments.
pat-token
: Personal Access Token (PAT) within the secrets of the repository initiating the workflow.owner
: Owner of the target repository where the workflow will be triggered.repo
: Name of the target repository where the workflow will be triggered.
message
: Message within the original repository containing the workflow results of the target repository.
Setup this yml file within the origin repository, which means the repository that wants to trigger another one:
name: Origin Repository Workflow
on:
pull_request:
branches:
- main
jobs:
cross-repo-pipeline:
runs-on: ubuntu-latest
steps: #here starts the action's setup
- name: cross-repo-pipeline-trigger
uses: amandastecz/pipeline-trigger@v1.1
with:
pat-token: ${{ secrets.PAT_TOKEN }} # add a secret called PAT_TOKEN
owner: target-owner #changeme
repo: target-repo #changeme
Inside the yml file of the target repository, please enable the "repository_dispatch" event, example:
name: Target Repository Workflow
on:
pull_request:
branches:
- main
workflow_dispatch:
repository_dispatch: #add this
jobs:
test: ...
E.g. Success message within PR comments:
This action uses the following secrets:
PAT_TOKEN
: Personal Access Token (PAT) classic.
- Create a
PAT Token
(classic) by following the GitHub instructions. - Select the necessary scopes for the personal token:
- repo - full control of private repositories
- workflow - update GitHub Action workflows
- admin:repo_hook - full control of repository hooks
- Add the
PAT_TOKEN
as a secret in the original repository. Follow the GitHub instructions.