Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
0cecc69
Create check_release_notes.yml
danudey Sep 1, 2023
ceaf695
Update check_release_notes.yml
danudey Sep 1, 2023
105ee1d
Update check_release_notes.yml
danudey Sep 1, 2023
0b92857
Update check_release_notes.yml
danudey Sep 1, 2023
0186a2e
Update check_release_notes.yml
danudey Sep 1, 2023
dc6f9bb
Add more test workflow stuff
danudey Jul 4, 2024
32974fe
Add more test workflow stuff
danudey Jul 4, 2024
a14d050
Add more test workflow stuff
danudey Jul 4, 2024
02bb706
Add more test workflow stuff
danudey Jul 4, 2024
494029e
Add more test workflow stuff
danudey Jul 4, 2024
3a4b946
Add more test workflow stuff
danudey Jul 4, 2024
c7e2d02
Add more test workflow stuff
danudey Jul 4, 2024
5cd7c69
Add more test workflow stuff
danudey Jul 4, 2024
5b3515b
Add more test workflow stuff
danudey Jul 4, 2024
110aa61
Add more test workflow stuff
danudey Jul 4, 2024
8366800
Add more test workflow stuff
danudey Jul 4, 2024
e937bf0
Add more test workflow stuff
danudey Jul 4, 2024
8a62af6
Add more test workflow stuff
danudey Jul 4, 2024
7c1a4dd
Add more test workflow stuff
danudey Jul 4, 2024
d4365a9
Add more test workflow stuff
danudey Jul 4, 2024
937cbf9
Add more test workflow stuff
danudey Jul 4, 2024
cdec8ff
Add more test workflow stuff
danudey Jul 4, 2024
2d0951f
Add more test workflow stuff
danudey Jul 4, 2024
9a2cf13
Add more test workflow stuff
danudey Jul 4, 2024
c139963
Add more test workflow stuff
danudey Jul 4, 2024
8f854b6
Add new test action
danudey Jul 4, 2024
7f156d9
Add new test action
danudey Jul 4, 2024
92e3b92
Don't use a specified version
danudey Jul 4, 2024
e949957
Use master
danudey Jul 4, 2024
8f37a4b
Test a new thing
danudey Aug 21, 2024
9a043d5
Test a new thing
danudey Aug 21, 2024
b50e596
Remove garbage
danudey Aug 21, 2024
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
38 changes: 38 additions & 0 deletions .github/workflows/check_release_notes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# This workflow will triage pull requests and apply a label based on the
# paths that are modified in the pull request.
#
# To use this workflow, you will need to set up a .github/labeler.yml
# file with configuration. For more information, see:
# https://github.com/actions/labeler

name: Labeler
on:
pull_request:
types: [labeled, unlabeled, edited, synchronize]

jobs:
label:

runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write

steps:
- name: Test New Action
uses: danudey/check-release-notes@main
# - name: Checkout
# uses: actions/checkout@v4
# with:
# sparse-checkout: .
# - name: Setup Python
# uses: actions/setup-python@v5
# with:
# python-version: '3.12'
# cache: 'pip' # caching pip dependencies
# - name: Install GitHub Python module
# id: gh-py-mod
# run: python3 -m pip install -U -r requirements.txt
# - name: Check Release Notes
# id: release-notes
# run: ./check_release_notes.py
58 changes: 58 additions & 0 deletions check_release_notes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/usr/bin/env python3

import os
import re
import sys
import json

import github

def get_env(env_name):
value = os.getenv(env_name)
# print(f"ENV {env_name} = {value}", file=sys.stdout)
return value

def fail(message):
with open(GITHUB_RESULT_PATH, "a+") as output_file:
output_file.write(message + "\n")
# print(f'FAIL: {message}', file=sys.stderr)
print(f'::error::{message}')

def info(message):
with open(GITHUB_RESULT_PATH, "a+") as output_file:
output_file.write(message + "\n")
# print(f'INFO: {message}', file=sys.stderr)
print(f'::notice::{message}')


GITHUB_EVENT_PATH = get_env("GITHUB_EVENT_PATH")
GITHUB_RESULT_PATH = get_env("GITHUB_STEP_SUMMARY")

github_data = json.load(open(GITHUB_EVENT_PATH))

gh = github.Github()

repo_name = get_env("GITHUB_REPOSITORY")
pr_number = github_data['number']

repo = gh.get_repo(repo_name)
pr = repo.get_pull(pr_number)

release_note_label = repo.get_label("release-note-required")

if release_note_label in pr.labels:
if result := re.search("(?<=```release-note\n).*?(?=\n```)", pr.body, re.DOTALL):
release_note = result.group().strip()
if not release_note:
fail('Release note is empty')
sys.exit(-1)
if release_note.lower() == "tbd":
fail('Release note contains "TBD"')
sys.exit(-1)
else:
fail('No release notes found in PR body')
sys.exit(-1)
else:
info('No release note required')

sys.exit(0)
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PyGithub
Loading