Actions to pull files from another repo

Is it possible to trigger workflows/actions from one repo based on the actions of another? Can a repository be the target of a webhook or other indicator?

If that’s possible, is it possible to search a specific repo for specific files and copy those files to the current repo (deleting out-of-date files)? If so, what’s the recommended format? script action inside a workflow? Run a script file in the repo? Manually run a script on a local machine? Max automation of this process is preferred.

Still in the idea/development and new to actions, so trying to understand the possiblities for this scenario. Thanks!

You should be able to do that with one of the Manual events (workflow_dispatch or repository_dispatch). The workflow that’s supposed to trigger that even will need a PAT with appropriate permissions for the API call.

The easiest way I can think of would be to check out that second repo into another directory, synchronize the files, and commit if git detects any changes. If you don’t want to check out the other repository, you might be able to use the API to retrieve the files you need.

Here are a few workflows that might give you ideas (first two pull upstream changes and open a PR, second two publish changes downstream for web hosting):

Thanks a lot for the pointers. I’ll check those out. We’re trying to avoid coming the repo and doing it locally because the repo is huge, so I’ll put some work into trying the API and studying those examples.

Thanks again (to you and luna)

1 Like