Skip to content

Commit 9c53168

Browse files
authored
Merge pull request #756 from 0xMiden/greenhat/i755-trigger-ci-in-release-pr
chore: trigger `ci.yml` workflow after the release PR is created
2 parents b1d05fb + 32ef9d3 commit 9c53168

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ permissions:
44
contents: read
55

66
on:
7+
workflow_dispatch:
78
push:
89
branches:
910
- main

.github/workflows/release.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,35 @@ jobs:
115115
- *checkout
116116
- *install-rust
117117
- name: Create release PR
118+
id: release-pr
118119
uses: release-plz/action@v0.5
119120
with:
120121
command: release-pr
121122
env:
122123
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
123124
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
125+
- name: Trigger CI for release PR
126+
uses: actions/github-script@v7
127+
with:
128+
github-token: ${{ secrets.GITHUB_TOKEN }}
129+
script: |
130+
const prOutputRaw = process.env.RELEASE_PLZ_PR;
131+
if (!prOutputRaw) {
132+
core.info('release-plz did not create or update a release PR; skipping CI trigger.');
133+
return;
134+
}
135+
const releasePr = JSON.parse(prOutputRaw);
136+
if (!releasePr?.head_branch) {
137+
core.info('release-plz PR output missing head branch; skipping CI trigger.');
138+
return;
139+
}
140+
const headRef = releasePr.head_branch;
141+
await github.rest.actions.createWorkflowDispatch({
142+
owner: context.repo.owner,
143+
repo: context.repo.repo,
144+
workflow_id: 'ci.yml',
145+
ref: headRef,
146+
});
147+
core.info(`Triggered CI workflow for ${headRef}.`);
148+
env:
149+
RELEASE_PLZ_PR: ${{ steps.release-pr.outputs.pr }}

0 commit comments

Comments
 (0)