Skip to content

Commit

Permalink
Add more test workflow stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
danudey committed Jul 4, 2024
1 parent 4c52a75 commit 7d35078
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/check_release_notes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
name: Labeler
on:
pull_request:
types: [labeled, unlabeled]
types: [labeled, unlabeled, edited]

jobs:
label:
Expand All @@ -25,4 +25,7 @@ jobs:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJSON(github) }}
run: echo "$GITHUB_CONTEXT"
run: echo "$GITHUB_CONTEXT"
- name: Get env
id: pr-info
run: env
22 changes: 22 additions & 0 deletions check_release_notes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env python3

import re
import sys
import json

input_data = json.loads(sys.stdin.read())
pr_body = input_data['body']

if result := re.search("(?<=```release-note\n).*?(?=\n```)", pr_body, re.DOTALL):
release_note = result.group().strip()
if not release_note:
print('FAIL: Release note is empty', file=sys.stderr)
sys.exit(-1)
if release_note.lower() == "tbd":
print('FAIL: Release note contains "TBD"', file=sys.stderr)
sys.exit(-1)
else:
print('FAIL: No release notes found in PR body', file=sys.stderr)
sys.exit(-1)

sys.exit(0)

0 comments on commit 7d35078

Please sign in to comment.