Skip to content

Commit 2d67d76

Browse files
authored
CI - Merge hooks (#4224)
# Description of Changes Invoke a private workflow when a PR merges, so that we can do extra follow-up actions. # API and ABI breaking changes None. CI only. # Expected complexity level and risk 2 # Testing - [x] When a PR merged with a corresponding private PR, I got a discord notification: <img width="543" height="70" alt="image" src="https://github.com/user-attachments/assets/209347c3-57be-47d7-8d75-6154c9e222cb" /> - [x] When a PR merged without a corresponding private PR, no discord notification --------- Signed-off-by: Zeke Foppa <196249+bfops@users.noreply.github.com> Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
1 parent f896974 commit 2d67d76

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

.github/workflows/discord-posts.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
sudo apt-get update
2121
sudo apt-get install -y gh
2222
23+
# TODO: Perhaps we should merge this into the public-pr-merge.yml workflow, now that that exists.
2324
- name: Send Discord notification
2425
env:
2526
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
@@ -69,3 +70,25 @@ jobs:
6970
# Use `jq` to construct the json data blob in the format required by the webhook.
7071
data="$(jq --null-input --arg msg "$message" '.content=$msg')"
7172
curl -X POST -H 'Content-Type: application/json' -d "$data" "${DISCORD_WEBHOOK_URL}"
73+
74+
invokePrivate:
75+
runs-on: ubuntu-latest
76+
if: github.event.pull_request.merged == true &&
77+
github.event.pull_request.base.ref == 'master'
78+
permissions:
79+
contents: read
80+
steps:
81+
- name: Dispatch private merge workflow
82+
uses: actions/github-script@v7
83+
with:
84+
github-token: ${{ secrets.SPACETIMEDB_PRIVATE_TOKEN }}
85+
script: |
86+
await github.rest.actions.createWorkflowDispatch({
87+
owner: 'clockworklabs',
88+
repo: 'SpacetimeDBPrivate',
89+
workflow_id: 'public-pr-merge.yml',
90+
ref: 'master',
91+
inputs: {
92+
public_pr_number: String(context.payload.pull_request.number),
93+
}
94+
});

0 commit comments

Comments
 (0)