I have a private GitHub repository named "Test Repo" under an organization. The repository has an action that performs a workflow and uploads an artifact (HTML). I have ten more private repositories named "Dev Repos" under the same organization.
Is there a way where the below steps could happen whenever there is a push in any of the "Dev Repos"?
- Trigger the "Test Repo" workflow. The "Dev Repos" should show a processing workflow status.
- Once the "Test Repo" workflow is complete, the artifact of the "Test Repo" should appear in the "Dev Repos" where the push was made.
Note: It'll be nice to use native approaches rather than 3rd party plugins :)
EDIT I
Below is the native approach to trigger the workflow of the "Test Repo" from the "Dev Repos".
name: CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Trigger Test Repo workflow
run: |
response = $(curl -H "Accept: application/vnd.github+json" -H "Authorization: token ${{ secrets.PERSONAL_ACCESS_TOKEN }}" --request POST --data '{"ref": "main"}' https://api.github.com/repos/{{organization}}/{{repository}}/actions/workflows/{{workflow-file}}.yml/dispatches)
However, the external actions (including the ones suggested by @VonC) do not trigger any action from the "Dev Repos" to the "Test Repo". The actions do not even show any error in the "Dev Repos". They just appear as successful.
You can try the GitHub Action "Trigger External Workflow" in order to triggers a workflow from another repository using
repository_dispatchevent.Then you can use
action-gh-releasein order to release your Tests packages in a Dev repository.See "How to release built artifacts from one to another repo on GitHub?" from Oyster Lee (also on Stack Overflow)