Skip to content

Commit

Permalink
Create PRs as drafts to prompt maintainers to trigger PR checks
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Henry Mercer committed Aug 3, 2021
1 parent 33927cc commit 7eb261e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
4 changes: 3 additions & 1 deletion .github/update-release-branch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 4 additions & 9 deletions .github/workflows/post-release-mergeback.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion .github/workflows/update-release-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down

0 comments on commit 7eb261e

Please sign in to comment.