From 7eb261eac81288eda9b0ec1fc3cdc8c064355b01 Mon Sep 17 00:00:00 2001 From: Henry Mercer Date: Tue, 3 Aug 2021 18:14:59 +0100 Subject: [PATCH 1/2] Create PRs as drafts to prompt maintainers to trigger PR checks PR checks won't be triggered on PRs created by Actions workflows. Therefore mark PRs created by workflows as draft to prompt maintainers to take the PR out of draft, thereby triggering PR checks. --- .github/update-release-branch.py | 4 +++- .github/workflows/post-release-mergeback.yml | 13 ++++--------- .github/workflows/update-release-branch.yml | 2 +- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/.github/update-release-branch.py b/.github/update-release-branch.py index 1addbaced..71f1cd1c7 100644 --- a/.github/update-release-branch.py +++ b/.github/update-release-branch.py @@ -93,7 +93,9 @@ def open_pr(repo, all_commits, short_main_sha, branch_name): title = 'Merge ' + MAIN_BRANCH + ' into ' + LATEST_RELEASE_BRANCH # Create the pull request - pr = repo.create_pull(title=title, body='\n'.join(body), head=branch_name, base=LATEST_RELEASE_BRANCH) + # PR checks won't be triggered on PRs created by Actions. Therefore mark the PR as draft so that + # a maintainer can take the PR out of draft, thereby triggering the PR checks. + pr = repo.create_pull(title=title, body='\n'.join(body), head=branch_name, base=LATEST_RELEASE_BRANCH, draft=True) print('Created PR #' + str(pr.number)) # Assign the conductor diff --git a/.github/workflows/post-release-mergeback.yml b/.github/workflows/post-release-mergeback.yml index ee92adbb4..636bd18d1 100644 --- a/.github/workflows/post-release-mergeback.yml +++ b/.github/workflows/post-release-mergeback.yml @@ -106,19 +106,14 @@ jobs: git commit -m "Update changelog and version after $VERSION" npm version patch - # when running this workflow on a PR, this is just a test. - # so put into draft mode. - if [ "$GITHUB_EVENT_NAME" == "pull_request" ]; then - DRAFT="--draft" - else - DRAFT="" - fi - git push origin "$NEW_BRANCH" + + # PR checks won't be triggered on PRs created by Actions. Therefore mark the PR as draft + # so that a maintainer can take the PR out of draft, thereby triggering the PR checks. gh pr create \ --head "$NEW_BRANCH" \ --base "$BASE_BRANCH" \ --title "$PR_TITLE" \ --label "Update dependencies" \ --body "$PR_BODY" \ - ${DRAFT:+"$DRAFT"} # no quotes around $DRAFT. gh will error out if there is an empty "" + --draft diff --git a/.github/workflows/update-release-branch.yml b/.github/workflows/update-release-branch.yml index f6a851084..60817f215 100644 --- a/.github/workflows/update-release-branch.yml +++ b/.github/workflows/update-release-branch.yml @@ -27,7 +27,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install PyGithub==1.51 requests + pip install PyGithub==1.55 requests - name: Update git config run: | From 2632b65a568f8a71eda2432339ad253429c6520a Mon Sep 17 00:00:00 2001 From: Henry Mercer Date: Tue, 3 Aug 2021 19:29:42 +0100 Subject: [PATCH 2/2] Add ready_for_review type to pull_request trigger types This runs checks on reopened draft PRs to support triggering PR checks on draft PRs that were opened by other workflows. --- .github/workflows/check-expected-release-files.yml | 3 +++ .github/workflows/codeql.yml | 3 +++ .github/workflows/pr-checks.yml | 3 +++ .github/workflows/python-deps.yml | 3 +++ .github/workflows/update-dependencies.yml | 2 +- 5 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-expected-release-files.yml b/.github/workflows/check-expected-release-files.yml index 56aa62519..123495e23 100644 --- a/.github/workflows/check-expected-release-files.yml +++ b/.github/workflows/check-expected-release-files.yml @@ -5,6 +5,9 @@ on: paths: - .github/workflows/check-expected-release-files.yml - src/defaults.json + # Run checks on reopened draft PRs to support triggering PR checks on draft PRs that were opened + # by other workflows. + types: [opened, synchronize, reopened, ready_for_review] jobs: check-expected-release-files: diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 3050dabec..37d759d35 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -5,6 +5,9 @@ on: branches: [main, v1] pull_request: branches: [main, v1] + # Run checks on reopened draft PRs to support triggering PR checks on draft PRs that were opened + # by other workflows. + types: [opened, synchronize, reopened, ready_for_review] jobs: # Identify the CodeQL tool versions to use in the analysis job. diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index 18ae97914..7bc1a76e1 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -7,6 +7,9 @@ on: push: branches: [main, v1] pull_request: + # Run checks on reopened draft PRs to support triggering PR checks on draft PRs that were opened + # by other workflows. + types: [opened, synchronize, reopened, ready_for_review] workflow_dispatch: jobs: diff --git a/.github/workflows/python-deps.yml b/.github/workflows/python-deps.yml index 63fbafb89..9cf5c0ad2 100644 --- a/.github/workflows/python-deps.yml +++ b/.github/workflows/python-deps.yml @@ -4,6 +4,9 @@ on: push: branches: [main, v1] pull_request: + # Run checks on reopened draft PRs to support triggering PR checks on draft PRs that were opened + # by other workflows. + types: [opened, synchronize, reopened, ready_for_review] jobs: test-setup-python-scripts: diff --git a/.github/workflows/update-dependencies.yml b/.github/workflows/update-dependencies.yml index afd20effb..51ac91867 100644 --- a/.github/workflows/update-dependencies.yml +++ b/.github/workflows/update-dependencies.yml @@ -1,7 +1,7 @@ name: Update dependencies on: pull_request_target: - types: [opened, synchronize, reopened, labeled] + types: [opened, synchronize, reopened, ready_for_review, labeled] jobs: update: