From 2775134a8f59b342e29700b5e0db4f2c8db1cf58 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Fri, 7 Jun 2024 20:25:18 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=AA=20Implement=20a=20draft=20based=20?= =?UTF-8?q?release=20PR=20CI=20trigger?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: * https://github.com/github/codeql-action/pull/2263#issuecomment-2078311173 * https://github.com/github/codeql-action/blob/4ebadbc7/.github/workflows/update-dependencies.yml#L38-L41 * https://github.com/github/codeql-action/pull/1868 * https://github.com/github/codeql-action/pull/679 --- .github/workflows/ci-cd.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index a06318cd9..6f7170d1b 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -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: @@ -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: >- @@ -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: >-