Trigger workflow B in a repo from workflow A in another repo #13490

Closed
opened 2025-11-02 10:44:02 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @AlterX76 on GitHub (Sep 14, 2024).

Feature Description

On Github Actions, there is a possibility to trigger a workflow from another repository through an API call, so the idea is Workflow1 runs and once arrived at a given state, it calls the API to trigger Workflow2 from another repository.

Here is what is used on Github’s side, it relies on the on: workflow_dispatch event and a REST route letting the user generate a custom event. A discussion regarding this can be found here: Triggering by other repository · community · Discussion #26323 · GitHub 118

Screenshots

No response

Originally created by @AlterX76 on GitHub (Sep 14, 2024). ### Feature Description On Github Actions, there is a possibility to trigger a workflow from another repository through an API call, so the idea is Workflow1 runs and once arrived at a given state, it calls the API to trigger Workflow2 from another repository. Here is what is used on Github’s side, it relies on the on: workflow_dispatch event and a REST route letting the user generate a custom event. A discussion regarding this can be found here: [Triggering by other repository · community · Discussion #26323 · GitHub 118](https://github.com/orgs/community/discussions/26323) ### Screenshots _No response_
GiteaMirror added the topic/gitea-actionstype/proposal labels 2025-11-02 10:44:02 -06:00
Author
Owner

@ChristopherHX commented on GitHub (Feb 6, 2025):

Is this issue about repository_dispatch or workflow_dispatch? Both are somewhat similar, but not the same.

I'm working on recreating the workflow_dispatch api here https://github.com/ChristopherHX/gitea/pull/new/workflow-dispatch-api
Still need to cleanup (extract common code of UI and api into a common package, error handling is so differently) and testing

Based on https://docs.github.com/en/rest/actions/workflows?apiVersion=2022-11-28#create-a-workflow-dispatch-event

curl -L \
  -X POST \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  http://localhost:3000/api/v1/repos/user5/repo4/actions/workflows/test.yml/dispatches \
  -d 'ref=refs/heads/master' -vv

curl -L \                                                                                            
  -X POST \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  http://localhost:3000/api/v1/repos/user5/repo4/actions/workflows/test.yml/dispatches \
  -d '{"ref":"refs/heads/master","inputs":{}}' -vv -H "Content-Type: application/json"
@ChristopherHX commented on GitHub (Feb 6, 2025): Is this issue about repository_dispatch or workflow_dispatch? Both are somewhat similar, but not the same. I'm working on recreating the workflow_dispatch api here <https://github.com/ChristopherHX/gitea/pull/new/workflow-dispatch-api> Still need to cleanup (extract common code of UI and api into a common package, error handling is so differently) and testing Based on <https://docs.github.com/en/rest/actions/workflows?apiVersion=2022-11-28#create-a-workflow-dispatch-event> ```bash curl -L \ -X POST \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" \ -H "X-GitHub-Api-Version: 2022-11-28" \ http://localhost:3000/api/v1/repos/user5/repo4/actions/workflows/test.yml/dispatches \ -d 'ref=refs/heads/master' -vv curl -L \ -X POST \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" \ -H "X-GitHub-Api-Version: 2022-11-28" \ http://localhost:3000/api/v1/repos/user5/repo4/actions/workflows/test.yml/dispatches \ -d '{"ref":"refs/heads/master","inputs":{}}' -vv -H "Content-Type: application/json" ```
Author
Owner

@ChristopherHX commented on GitHub (Feb 6, 2025):

This seem to duplicate https://github.com/go-gitea/gitea/issues/31765 issue

@ChristopherHX commented on GitHub (Feb 6, 2025): This seem to duplicate https://github.com/go-gitea/gitea/issues/31765 issue
Author
Owner

@lunny commented on GitHub (Feb 6, 2025):

Close as duplicate of #31765

@lunny commented on GitHub (Feb 6, 2025): Close as duplicate of #31765
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#13490