Skip to content

Commit 2775134

Browse files
committed
🧪 Implement a draft based release PR CI trigger
Normally, PRs/commits published using the default GitHub Actions CI/CD API token are not propagated to any integrations. This patch marks the release PR as a draft and leaves a comment asking the maintainers to mark it as ready for review in order to actually trigger a CI run. This idea is found in GitHub's own repos: * github/codeql-action#2263 (comment) * https://github.com/github/codeql-action/blob/4ebadbc7/.github/workflows/update-dependencies.yml#L38-L41 * github/codeql-action#1868 * github/codeql-action#679
1 parent 32ee217 commit 2775134

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

.github/workflows/ci-cd.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ on: # yamllint disable-line rule:truthy
1717
pull_request:
1818
paths-ignore: # NOTE: cannot be combined with "paths"
1919
- docs/**.rst
20+
types:
21+
- opened # default
22+
- synchronize # default
23+
- reopened # default
24+
- ready_for_review # used in PRs created from the release workflow
2025
workflow_dispatch:
2126
inputs:
2227
release-version:
@@ -1737,6 +1742,7 @@ jobs:
17371742
Automated changelog generation with the version
17381743
${{ needs.pre-setup.outputs.dist-version }}.
17391744
PULL_REQUEST_BRANCH: ${{ github.event.repository.default_branch }}
1745+
PULL_REQUEST_DRAFT: true
17401746
PULL_REQUEST_FROM_BRANCH: >-
17411747
release/${{ needs.pre-setup.outputs.dist-version }}
17421748
PULL_REQUEST_TITLE: >-
@@ -1745,6 +1751,14 @@ jobs:
17451751
run: |
17461752
echo "PR number: ${{ steps.pr.outputs.pull_request_number }}"
17471753
echo "PR URL: ${{ steps.pr.outputs.pull_request_url }}"
1754+
- name: Instruct the maintainers to trigger CI by undrafting the PR
1755+
env:
1756+
GITHUB_TOKEN: ${{ github.token }}
1757+
run: >-
1758+
gh pr comment
1759+
--body 'Please mark the PR as ready for review to trigger PR checks.'
1760+
--repo '${{ github.repository }}'
1761+
'${{ steps.pr.outputs.pull_request_number }}'
17481762
17491763
publish-github-release:
17501764
name: >-

0 commit comments

Comments
 (0)