Skip to content
Merged
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
48 changes: 34 additions & 14 deletions .github/workflows/notify-downstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,33 +33,53 @@ jobs:

- name: Extract commit info
id: commit
env:
GH_REPOSITORY: ${{ github.repository }}
GH_REPO_NAME: ${{ github.event.repository.name }}
GH_ACTOR: ${{ github.actor }}
run: |
write_output() {
local key="$1" value="$2"
local delim="__EOF__$(date +%s%N)_$RANDOM"
{
printf '%s<<%s\n' "$key" "$delim"
printf '%s\n' "$value"
printf '%s\n' "$delim"
} >> "$GITHUB_OUTPUT"
}

MSG=$(git log -1 --pretty=%s)
echo "message=$MSG" >> $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
write_output message "$MSG"
write_output repo "$GH_REPOSITORY"
write_output repo_name "$GH_REPO_NAME"
write_output actor "$GH_ACTOR"
write_output sha "$(git rev-parse HEAD)"
write_output short_sha "$(git rev-parse --short HEAD)"

re_feat='^feat[!:(]'; re_fix='^fix[!:(]'; re_chore='^chore[!:(]'
re_docs='^docs[!:(]'; re_test='^test[!:(]'; re_refactor='^refactor[!:(]'
if [[ "$MSG" =~ $re_feat ]]; then write_output type "feat"
elif [[ "$MSG" =~ $re_fix ]]; then write_output type "fix"
elif [[ "$MSG" =~ $re_chore ]]; then write_output type "chore"
elif [[ "$MSG" =~ $re_docs ]]; then write_output type "docs"
elif [[ "$MSG" =~ $re_test ]]; then write_output type "test"
elif [[ "$MSG" =~ $re_refactor ]]; then write_output type "refactor"
else write_output type "other"
fi

- name: Notify ${{ matrix.downstream }}
uses: peter-evans/repository-dispatch@v3
uses: peter-evans/repository-dispatch@v4
with:
token: ${{ secrets.PARENT_REPO_PAT }}
repository: harmony-labs/${{ matrix.downstream }}
event-type: dependency-updated
client-payload: >-
{
"repo": ${{ toJSON(github.repository) }},
"repo_name": ${{ toJSON(github.event.repository.name) }},
"repo": ${{ toJSON(steps.commit.outputs.repo) }},
"repo_name": ${{ toJSON(steps.commit.outputs.repo_name) }},
"sha": ${{ toJSON(steps.commit.outputs.sha) }},
"short_sha": ${{ toJSON(steps.commit.outputs.short_sha) }},
"message": ${{ toJSON(steps.commit.outputs.message) }},
"type": ${{ toJSON(steps.commit.outputs.type) }},
"actor": ${{ toJSON(github.actor) }}
"actor": ${{ toJSON(steps.commit.outputs.actor) }}
}
Comment on lines 76 to 85

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Breaking payload change for downstream consumers

The PR removes repo_name, short_sha, message, and type from the dispatched payload. If any downstream workflow (e.g. in meta_cli, meta_git_cli, meta_project_cli, or meta_rust_cli) currently references github.event.client_payload.type, .message, .short_sha, or .repo_name, those expressions will silently resolve to null/empty without any dispatch failure.

Before merging, confirm that none of the downstream repos' repository_dispatch-triggered workflows use these removed fields. If they do, those workflows should be updated in the same change or in a coordinated follow-up to avoid silent failures.

Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/notify-downstream.yml
Line: 42-47

Comment:
**Breaking payload change for downstream consumers**

The PR removes `repo_name`, `short_sha`, `message`, and `type` from the dispatched payload. If any downstream workflow (e.g. in `meta_cli`, `meta_git_cli`, `meta_project_cli`, or `meta_rust_cli`) currently references `github.event.client_payload.type`, `.message`, `.short_sha`, or `.repo_name`, those expressions will silently resolve to `null`/empty without any dispatch failure.

Before merging, confirm that none of the downstream repos' `repository_dispatch`-triggered workflows use these removed fields. If they do, those workflows should be updated in the same change or in a coordinated follow-up to avoid silent failures.

How can I resolve this? If you propose a fix, please make it concise.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed — restored full payload, removed repository_dispatch trigger to prevent cascades, switched to heredoc output for safe commit message handling.

Loading