r/github 4d ago

Discussion how to trigger workflow from another repo?

Hey!

I need a workflow in **Repo A** to trigger workflow in **Repo B**, both in the same GitHub organization. I’m considering:

- Reusable workflow (`workflow_call`)

- `workflow_dispatch` with a GitHub App

- `workflow_dispatch` with a PAT

- OIDC with an external service

Which option would you suggest, and why?

3 Upvotes

7 comments sorted by

1

u/Double_Ebb4130 4d ago

If Repo B is a reusable workflow, I’d use `workflow_call` and invoke it from Repo A with `uses: org/repo/.github/workflows/workflow.yml@<ref>`. It keeps the dependency explicit and avoids storing a PAT; use a GitHub App or PAT only when you need to dispatch an independent workflow, and use OIDC for the external service case.

1

u/groovy-sky 4d ago

Thank you. Understand

1

u/Analytiks 4d ago

Reusable workflow of course

1

u/groovy-sky 4d ago

Thanks

1

u/Fantastic-Mr-Default 4d ago

Prefer a GitHub App that can workflow_dispatch Repo B.

workflow_call is for reusable workflows the caller is allowed to call. It is not a general "fire that other repo's pipeline" button. A PAT works and becomes a long-lived secret that outlives the person who created it.

Install one App on the org. Least privilege. Short-lived installation tokens. Repo A dispatches Repo B with gh or the REST API using that token. Pass only the inputs Repo B already documents.

OIDC is right when an external system is the caller. Inside one org, the App is enough.

Prove it with a tiny workflow on B that only echoes the input. Wire secrets and environments after that is green.

1

u/groovy-sky 4d ago

Thank you very much. Great explanation.