Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Pull Request validation

on:
pull_request:
types:
- opened
- reopened
- edited
- labeled
- unlabeled

jobs:
pull-request-validation:
name: Pull Request validation.
runs-on: ubuntu-latest
steps:
- name: Pull Request should have a label assigned.
if: ${{ always() && github.event.pull_request.labels[0] == null }}
run: |
exit 1

- name: Title should start with a Jira ticket.
if: ${{ always() && !(startsWith(github.event.pull_request.title, 'CSHARP-')) }}
run: |
exit 1

- name: Title should not end with period or ellipses.
if: ${{ always() && (endsWith(github.event.pull_request.title, '.') || endsWith(github.event.pull_request.title, '…')) }}
run: |
exit 1
7 changes: 4 additions & 3 deletions evergreen/release-notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def load_config(opts):


def mapPullRequest(pullRequest, opts):
title = pullRequest["title"]
title = pullRequest["title"].encode('ascii', 'backslashreplace').decode().replace("<", "\<")
for regex in opts.template["autoformat"]:
title = re.sub(regex["match"], regex["replace"], title)

Expand Down Expand Up @@ -91,7 +91,9 @@ def load_pull_requests(opts):
github_api_base_url=opts.github_api_base_url,
repo=opts.repo,
commit_sha=commit["sha"])
pullrequests = requests.get(pullrequests_url, headers=opts.github_headers).json()
pullrequests_response = requests.get(pullrequests_url, headers=opts.github_headers)
pullrequests_response.raise_for_status()
pullrequests = pullrequests_response.json()
for pullrequest in pullrequests:
mapped = mapPullRequest(pullrequest, opts)
if is_in_section(mapped, ignore_section):
Expand Down Expand Up @@ -140,7 +142,6 @@ def publish_release_notes(opts, title, content):
print("Publishing release notes...")
url = '{github_api_base_url}{repo}/releases/tags/{tag}'.format(github_api_base_url=opts.github_api_base_url, repo=opts.repo, tag=opts.version_tag)
response = requests.get(url, headers=opts.github_headers)
response.raise_for_status()
if response.status_code != 404:
raise SystemExit("Release with the tag already exists")

Expand Down
Loading