Is it possible to run a github action on a push to a 2nd repository?
For example, I have 2 repos:
Application
Library
As soon as I push to Library, I would like the Library CI to run, but also run the CI for the Application, to see if the application still works with the changes in the Library.
So in the application’s workflow, you could listen for a repository dispatch event:
on: repository_dispatch
And then in the library’s workflow, you could send a repository dispatch event. You’ll need to set up a personal access token as a secret in the library’s repository:
Even if it doesn’t really work for my specific usecase, it does seem like a valid way to solve my question.
I have 1 library that is used by about 10 different repositories. And I don’t want to add knowledge about those external repositories to my main library repository. My home grown CI solution currently allows this “watch link”, but I understand that it’s a bit of an odd usecase.
I also found that the only permission required for the token was “public_repo Access public repositories”. Lot of trial and error so hopefully this will save someone else the time.
This is pretty important for our CI across an SDK which is split into various modules across different repos. It’s something that’s supported in Jenkins. Hopefully this will be functionality that arrives at some point.
We also don’t want to hardcode details about consumer modules in our library modules. One solution could be to use a webhook, then from the webhook invoke the workflows using repo dispatch. Feels like quite a bit of effort to set this up though and dependency context would need sorted somewhere else too.
Another option could be to have an intermediate repo which holds workflows which hold teh dependency contexts, so the lib workflow simply uses repository dispatch on a workflow in the intermediate repo. That workflow then does a repo dispatch on the required workflows in other repos. If dependencies change, then they can be updated in one place.
The Problem is simple and a default situation nearly every developer is in.
Java + maven Example
1 Repo with a lib => Version 0.1.0-SNAPSHOT
1 Repo with the app =>depends on repo lib => 0.1.0-SNAPSHOT
both repos are own be the same developer/company
1 Developer commits something to the lib => i want to rebuild the app fully automated. without knowledge in the lib which app uses this lib.
any idea? i havent found some solution for this use case