Skip to content

Commit

Permalink
🧪 Implement a draft based release PR CI trigger
Browse files Browse the repository at this point in the history
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
  • Loading branch information
webknjaz committed Jun 7, 2024
1 parent 32ee217 commit 2775134
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ on: # yamllint disable-line rule:truthy
pull_request:
paths-ignore: # NOTE: cannot be combined with "paths"
- docs/**.rst
types:
- opened # default
- synchronize # default
- reopened # default
- ready_for_review # used in PRs created from the release workflow
workflow_dispatch:
inputs:
release-version:
Expand Down Expand Up @@ -1737,6 +1742,7 @@ jobs:
Automated changelog generation with the version
${{ needs.pre-setup.outputs.dist-version }}.
PULL_REQUEST_BRANCH: ${{ github.event.repository.default_branch }}
PULL_REQUEST_DRAFT: true
PULL_REQUEST_FROM_BRANCH: >-
release/${{ needs.pre-setup.outputs.dist-version }}
PULL_REQUEST_TITLE: >-
Expand All @@ -1745,6 +1751,14 @@ jobs:
run: |
echo "PR number: ${{ steps.pr.outputs.pull_request_number }}"
echo "PR URL: ${{ steps.pr.outputs.pull_request_url }}"
- name: Instruct the maintainers to trigger CI by undrafting the PR
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh pr comment
--body 'Please mark the PR as ready for review to trigger PR checks.'
--repo '${{ github.repository }}'
'${{ steps.pr.outputs.pull_request_number }}'
publish-github-release:
name: >-
Expand Down

0 comments on commit 2775134

Please sign in to comment.