Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
branches: [main]
pull_request:
branches: [main]
repository_dispatch:
types: [dependency-updated]

env:
CARGO_TERM_COLOR: always
Expand Down
72 changes: 72 additions & 0 deletions .github/workflows/notify-parent.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Notify Parent Repo

on:
push:
branches: [main]
repository_dispatch:
types: [dependency-updated]

jobs:
wait-for-ci:
runs-on: ubuntu-latest
steps:
- name: Wait for CI
uses: lewagon/wait-on-check-action@v1.5.0
with:
ref: ${{ github.sha }}
check-name: 'Test (ubuntu-latest)'
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 10

notify-parent:
needs: wait-for-ci
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Determine source
id: source
run: |
if [ "${{ github.event_name }}" = "repository_dispatch" ]; then
echo "repo=${{ github.event.client_payload.repo }}" >> $GITHUB_OUTPUT
echo "repo_name=${{ github.event.client_payload.repo_name }}" >> $GITHUB_OUTPUT
echo "sha=${{ github.event.client_payload.sha }}" >> $GITHUB_OUTPUT
echo "short_sha=${{ github.event.client_payload.short_sha }}" >> $GITHUB_OUTPUT
echo "message=${{ github.event.client_payload.message }}" >> $GITHUB_OUTPUT
echo "type=${{ github.event.client_payload.type }}" >> $GITHUB_OUTPUT
echo "actor=${{ github.event.client_payload.actor }}" >> $GITHUB_OUTPUT
else
MSG=$(git log -1 --pretty=%s)
echo "message=$MSG" >> $GITHUB_OUTPUT
echo "repo=${{ github.repository }}" >> $GITHUB_OUTPUT
echo "repo_name=${{ github.event.repository.name }}" >> $GITHUB_OUTPUT
echo "actor=${{ github.actor }}" >> $GITHUB_OUTPUT
echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
if [[ "$MSG" =~ ^feat[:(] ]]; then echo "type=feat" >> $GITHUB_OUTPUT
elif [[ "$MSG" =~ ^fix[:(] ]]; then echo "type=fix" >> $GITHUB_OUTPUT
elif [[ "$MSG" =~ ^chore[:(] ]]; then echo "type=chore" >> $GITHUB_OUTPUT
elif [[ "$MSG" =~ ^docs[:(] ]]; then echo "type=docs" >> $GITHUB_OUTPUT
elif [[ "$MSG" =~ ^test[:(] ]]; then echo "type=test" >> $GITHUB_OUTPUT
elif [[ "$MSG" =~ ^refactor[:(] ]]; then echo "type=refactor" >> $GITHUB_OUTPUT
else echo "type=other" >> $GITHUB_OUTPUT
fi
fi

- name: Notify parent repo
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.PARENT_REPO_PAT }}
repository: harmony-labs/meta
event-type: child-repo-updated
client-payload: >-
{
"repo": ${{ toJSON(steps.source.outputs.repo) }},
"repo_name": ${{ toJSON(steps.source.outputs.repo_name) }},
"sha": ${{ toJSON(steps.source.outputs.sha) }},
"short_sha": ${{ toJSON(steps.source.outputs.short_sha) }},
"message": ${{ toJSON(steps.source.outputs.message) }},
"type": ${{ toJSON(steps.source.outputs.type) }},
"actor": ${{ toJSON(steps.source.outputs.actor) }}
}