Reputation: 1125
If I have a public repo which has a workflow setup to be triggered when something is pushed to master, can I then trigger another workflow from a different repo to trigger?
The reason I want to do this is because my public repo is used to allow anyone to contribute but I want to make another repo which is private that handles the build process/deployment that can't be seen. Is there a better way to handle this kind of use case with GitHub actions? - I basically don't want my build process on my server to be public.
Upvotes: 5
Views: 6114
Reputation: 1125
From doing more research I found this marketplace plug-in which solves what I want and calls another repository which triggers another build which is a private repository, you can enter a name of your choice and have a front facing repo which is public and keep all your CI/CD stuff in a private repo:
https://github.com/marketplace/actions/dispatch-action (Deprecated, use https://github.com/marketplace/actions/repository-dispatch instead)
Upvotes: 7
Reputation: 2268
name: Trigger automation tests
steps:
- uses: actions/github-script@v6
with:
github-token: ${{ secrets.PERSONAL_TOKEN }}
script: |
await github.rest.actions.createWorkflowDispatch({
owner: '*****',
repo: '*****',
workflow_id: '*****.yml',
ref: 'main'
})
owner = organization / personal gitHub.
repo = target repository to run.
workflow_id = yml file name of the target workflow.
ref = which brench to run in target repository
Upvotes: 5