Skip to content

Commit d98d4f5

Browse files
authored
Merge pull request #679 from github/henrymercer/triggering-pr-checks
Create PRs as drafts to prompt maintainers to trigger PR checks
2 parents 33927cc + 2632b65 commit d98d4f5

8 files changed

+21
-12
lines changed

.github/update-release-branch.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,9 @@ def open_pr(repo, all_commits, short_main_sha, branch_name):
9393
title = 'Merge ' + MAIN_BRANCH + ' into ' + LATEST_RELEASE_BRANCH
9494

9595
# Create the pull request
96-
pr = repo.create_pull(title=title, body='\n'.join(body), head=branch_name, base=LATEST_RELEASE_BRANCH)
96+
# PR checks won't be triggered on PRs created by Actions. Therefore mark the PR as draft so that
97+
# a maintainer can take the PR out of draft, thereby triggering the PR checks.
98+
pr = repo.create_pull(title=title, body='\n'.join(body), head=branch_name, base=LATEST_RELEASE_BRANCH, draft=True)
9799
print('Created PR #' + str(pr.number))
98100

99101
# Assign the conductor

.github/workflows/check-expected-release-files.yml

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
paths:
66
- .github/workflows/check-expected-release-files.yml
77
- src/defaults.json
8+
# Run checks on reopened draft PRs to support triggering PR checks on draft PRs that were opened
9+
# by other workflows.
10+
types: [opened, synchronize, reopened, ready_for_review]
811

912
jobs:
1013
check-expected-release-files:

.github/workflows/codeql.yml

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
branches: [main, v1]
66
pull_request:
77
branches: [main, v1]
8+
# Run checks on reopened draft PRs to support triggering PR checks on draft PRs that were opened
9+
# by other workflows.
10+
types: [opened, synchronize, reopened, ready_for_review]
811

912
jobs:
1013
# Identify the CodeQL tool versions to use in the analysis job.

.github/workflows/post-release-mergeback.yml

+4-9
Original file line numberDiff line numberDiff line change
@@ -106,19 +106,14 @@ jobs:
106106
git commit -m "Update changelog and version after $VERSION"
107107
npm version patch
108108
109-
# when running this workflow on a PR, this is just a test.
110-
# so put into draft mode.
111-
if [ "$GITHUB_EVENT_NAME" == "pull_request" ]; then
112-
DRAFT="--draft"
113-
else
114-
DRAFT=""
115-
fi
116-
117109
git push origin "$NEW_BRANCH"
110+
111+
# PR checks won't be triggered on PRs created by Actions. Therefore mark the PR as draft
112+
# so that a maintainer can take the PR out of draft, thereby triggering the PR checks.
118113
gh pr create \
119114
--head "$NEW_BRANCH" \
120115
--base "$BASE_BRANCH" \
121116
--title "$PR_TITLE" \
122117
--label "Update dependencies" \
123118
--body "$PR_BODY" \
124-
${DRAFT:+"$DRAFT"} # no quotes around $DRAFT. gh will error out if there is an empty ""
119+
--draft

.github/workflows/pr-checks.yml

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ on:
77
push:
88
branches: [main, v1]
99
pull_request:
10+
# Run checks on reopened draft PRs to support triggering PR checks on draft PRs that were opened
11+
# by other workflows.
12+
types: [opened, synchronize, reopened, ready_for_review]
1013
workflow_dispatch:
1114

1215
jobs:

.github/workflows/python-deps.yml

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
push:
55
branches: [main, v1]
66
pull_request:
7+
# Run checks on reopened draft PRs to support triggering PR checks on draft PRs that were opened
8+
# by other workflows.
9+
types: [opened, synchronize, reopened, ready_for_review]
710

811
jobs:
912
test-setup-python-scripts:

.github/workflows/update-dependencies.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Update dependencies
22
on:
33
pull_request_target:
4-
types: [opened, synchronize, reopened, labeled]
4+
types: [opened, synchronize, reopened, ready_for_review, labeled]
55

66
jobs:
77
update:

.github/workflows/update-release-branch.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- name: Install dependencies
2828
run: |
2929
python -m pip install --upgrade pip
30-
pip install PyGithub==1.51 requests
30+
pip install PyGithub==1.55 requests
3131
3232
- name: Update git config
3333
run: |

0 commit comments

Comments
 (0)