You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
to avoid bugs in this package going unnoticed in downstream packages i.e #205 should find use gha dispatching to trigger the CI pipelines in the other packages, would make it a lot easier to catch bugs early
The text was updated successfully, but these errors were encountered:
name: Dispatch to Downstream Repos
on:
release:
types: [published]
jobs:
notify_downstream:
runs-on: ubuntu-latest
steps:
- name: Send repository dispatch to downstream projects
env:
GH_TOKEN: ${{ secrets.REPO_DISPATCH_TOKEN }}
run: |
repos=("downstream-repo1" "downstream-repo2" "downstream-repo3")
for repo in "${repos[@]}"; do
curl -X POST -H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token $GH_TOKEN" \
https://api.github.com/repos/your-org/$repo/dispatches \
-d '{"event_type": "core_package_release"}'
done
Explanation:
• Runs when a new release is published.
• Sends a repository dispatch event to each downstream repo.
• Uses a GitHub personal access token (PAT) stored as REPO_DISPATCH_TOKEN.
Set Up the GitHub PAT (REPO_DISPATCH_TOKEN)
• Create a Personal Access Token (PAT) with repo scope.
• Add it as a secret in the core package repo:
• Go to Settings → Secrets and variables → Actions
• Add a new secret REPO_DISPATCH_TOKEN with the PAT.
Update Downstream Repositories
Each downstream repo needs to listen for the repository_dispatch event.
Create .github/workflows/on-core-release.yml in downstream repos:
name: Run Tests on Core Package Release
on:
repository_dispatch:
types: [core_package_release]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: |
pip install -U core-package-name
pip install -r requirements.txt
- name: Run tests
run: pytest
Explanation:
• The workflow listens for the repository_dispatch event.
• When triggered, it installs the latest version of the core package and runs tests.
to avoid bugs in this package going unnoticed in downstream packages i.e #205 should find use gha dispatching to trigger the CI pipelines in the other packages, would make it a lot easier to catch bugs early
The text was updated successfully, but these errors were encountered: