From 8bb130a710dab0a0854b95ca32ecd2fb81ae82ff Mon Sep 17 00:00:00 2001 From: DudeNr33 <3929834+DudeNr33@users.noreply.github.com> Date: Mon, 6 Jun 2022 10:11:21 +0200 Subject: [PATCH 01/10] First draft for automatic generation of changelog entries --- .pre-commit-config.yaml | 10 +++- doc/conf.py | 11 ++++ doc/exts/pylint_changelog.py | 95 +++++++++++++++++++++++++++++++++++ doc/requirements.txt | 1 + doc/whatsnew/2/2.15/index.rst | 53 +++++++++---------- 5 files changed, 139 insertions(+), 31 deletions(-) create mode 100644 doc/exts/pylint_changelog.py diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index aee7aa46f2..6a715d5a03 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -84,7 +84,7 @@ repos: rev: "v6.0.0rc3" hooks: - id: rstcheck - args: ["--report-level=warning"] + args: ["--report-level=warning", "--ignore-directives=changelog"] files: ^(doc/(.*/)*.*\.rst) additional_dependencies: [Sphinx==4.5.0] - repo: https://github.com/pre-commit/mirrors-mypy @@ -97,7 +97,13 @@ repos: types: [python] args: [] require_serial: true - additional_dependencies: ["platformdirs==2.2.0", "types-pkg_resources==0.1.3"] + additional_dependencies: + [ + "platformdirs==2.2.0", + "types-pkg_resources==0.1.3", + "types-docutils==0.18.3", + "PyGithub==1.55", + ] exclude: tests(/\w*)*/functional/|tests/input|tests(/.*)+/conftest.py|doc/data/messages|tests(/\w*)*data/ - repo: https://github.com/pre-commit/mirrors-prettier rev: v2.6.2 diff --git a/doc/conf.py b/doc/conf.py index 3f0c1177b4..6e285ebe51 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -40,6 +40,7 @@ "pylint_extensions", "pylint_messages", "pylint_options", + "pylint_changelog", "sphinx.ext.autosectionlabel", "sphinx.ext.intersphinx", "sphinx_reredirects", @@ -297,3 +298,13 @@ autosectionlabel_prefix_document = True linkcheck_ignore = ["https://github.com/PyCQA/pylint/blob/main/pylint/extensions/.*"] + + +# -- Options for pylint_changelog extension ------------------------------------ + +pylint_changelog_user = "PyCQA" +pylint_changelog_project = "pylint" +pylint_changelog_token = os.getenv("GITHUB_TOKEN") +pylint_changelog_exclude_labels = [ + "Documentation 📖", +] diff --git a/doc/exts/pylint_changelog.py b/doc/exts/pylint_changelog.py new file mode 100644 index 0000000000..0a83c6faec --- /dev/null +++ b/doc/exts/pylint_changelog.py @@ -0,0 +1,95 @@ +#!/usr/bin/env python + +# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html +# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt + +"""Custom extension to automatically generate changelog sections +from GitHub issues. +""" +from __future__ import annotations + +from collections.abc import Iterable + +from docutils import frontend, nodes +from docutils.parsers.rst import Parser, directives +from docutils.utils import new_document +from github import Github +from github.Issue import Issue +from sphinx.application import Sphinx +from sphinx.parsers import RSTParser +from sphinx.util import logging +from sphinx.util.docutils import SphinxDirective + +logger = logging.getLogger(__name__) + + +class ChangelogDirective(SphinxDirective): + option_spec = { + "query": directives.unchanged_required, + "caption": directives.unchanged, + "hide_if_empty": directives.flag, + } + has_content = True + parser = RSTParser() + + def run(self): + result = [] + caption = self.options.get("caption") + if caption: + result.append(nodes.title(text=caption)) + list_node = nodes.bullet_list( + *( + self._build_changelog_entry(issue) + for issue in self._get_relevant_issues() + ) + ) + result.append(list_node) + logger.info("Found %d issues for this query.", len(list_node)) + if not list_node and self.options.get("hide_if_empty", False): + logger.info("Flag 'hide_if_empty' is set, hiding this section.") + return [] + return result + + def _get_relevant_issues(self) -> Iterable[Issue]: + full_query = self._build_query() + token = self.config.pylint_changelog_token + if not token: + logger.warning( + "No token provided. " + "Unauthenticated requests are subject to rate limiting, " + "and changelog generation may fail." + ) + gh = Github(login_or_token=self.config.pylint_changelog_token) + logger.info("Searching for pull requests matching query %s", full_query) + return gh.search_issues(query=full_query) + + def _build_query(self) -> str: + user = self.config.pylint_changelog_user + project = self.config.pylint_changelog_project + query = self.options.get("query") + full_query = f"is:pr is:closed repo:{user}/{project} {query}" + for excluded_label in self.config.pylint_changelog_exclude_labels: + full_query += f' -label:"{excluded_label}"' + return full_query + + def _build_changelog_entry(self, issue: Issue) -> nodes.list_item: + text = f"{issue.title}\n\nPR: `#{issue.number} `_" + return nodes.list_item("", *self._parse_as_rst(text).children) + + def _parse_as_rst(self, text: str) -> nodes.document: + parser = Parser() + components = (Parser,) + settings = frontend.OptionParser(components=components).get_default_values() + document = new_document("", settings=settings) + parser.parse(text, document) + return document + + +def setup(app: Sphinx) -> dict[str, str | bool]: + app.add_config_value("pylint_changelog_user", None, "html") + app.add_config_value("pylint_changelog_project", None, "html") + app.add_config_value("pylint_changelog_token", None, "html") + app.add_config_value("pylint_changelog_exclude_labels", [], "html") + app.add_directive("changelog", ChangelogDirective) + return {"version": "0.1", "parallel_read_safe": True} diff --git a/doc/requirements.txt b/doc/requirements.txt index 326cc2fc2f..7d162fca48 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -2,4 +2,5 @@ Sphinx==4.5.0 sphinx-reredirects<1 myst-parser~=0.17 furo==2022.4.7 +PyGithub==1.55 -e . diff --git a/doc/whatsnew/2/2.15/index.rst b/doc/whatsnew/2/2.15/index.rst index 6a285fe028..8c5d77167a 100644 --- a/doc/whatsnew/2/2.15/index.rst +++ b/doc/whatsnew/2/2.15/index.rst @@ -11,39 +11,34 @@ Summary -- Release highlights ============================= +.. changelog:: + :caption: New checkers + :query: is:closed is:pr milestone:2.15.0 label:"New checker ✨" -New checkers -============ +.. changelog:: + :caption: Removed checkers + :query: is:closed is:pr milestone:2.15.0 label:"Removed checker ❌" +.. changelog:: + :caption: Extensions + :query: is:closed is:pr milestone:2.15.0 label:"Extension" -Removed checkers -================ +.. changelog:: + :caption: False positives fixed + :query: is:closed is:pr milestone:2.15.0 label:"False Positive 🦟" +.. changelog:: + :caption: False negatives fixed + :query: is:closed is:pr milestone:2.15.0 label:"False Negative 🦋" -Extensions -========== +.. changelog:: + :caption: Other bug fixes + :query: is:closed is:pr milestone:2.15.0 label:"Bug 🪳" -label:"False Negative 🦋" -label:"False Positive 🦟" +.. changelog:: + :caption: Other Changes + :query: is:closed is:pr milestone:2.15.0 -label:"False Negative 🦋" -label:"False Positive 🦟" -label:"Bug 🪳" -label:"New checker ✨" -label:"Removed checker ❌" -False positives fixed -===================== - - -False negatives fixed -===================== - -* Emit ``modified-iterating-list`` and analogous messages for dicts and sets when iterating - literals, or when using the ``del`` keyword. - - Closes #6648 - - -Other bug fixes -=============== - - -Other Changes -============= - - -Internal changes -================ +.. changelog:: + :caption: Internal changes + :query: is:closed is:pr milestone:2.15.0 label:"Maintenance" From 8faf3a75f73d931f64143094b81b5e197efe7a3c Mon Sep 17 00:00:00 2001 From: DudeNr33 <3929834+DudeNr33@users.noreply.github.com> Date: Mon, 6 Jun 2022 15:43:52 +0200 Subject: [PATCH 02/10] Skip changelog generation if no token was provided. --- doc/exts/pylint_changelog.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/doc/exts/pylint_changelog.py b/doc/exts/pylint_changelog.py index 0a83c6faec..d47ad92a0b 100644 --- a/doc/exts/pylint_changelog.py +++ b/doc/exts/pylint_changelog.py @@ -34,6 +34,9 @@ class ChangelogDirective(SphinxDirective): parser = RSTParser() def run(self): + if not self.config.pylint_changelog_token: + logger.warning("A GitHub token is required to generate the changelog.") + return [] result = [] caption = self.options.get("caption") if caption: @@ -53,13 +56,6 @@ def run(self): def _get_relevant_issues(self) -> Iterable[Issue]: full_query = self._build_query() - token = self.config.pylint_changelog_token - if not token: - logger.warning( - "No token provided. " - "Unauthenticated requests are subject to rate limiting, " - "and changelog generation may fail." - ) gh = Github(login_or_token=self.config.pylint_changelog_token) logger.info("Searching for pull requests matching query %s", full_query) return gh.search_issues(query=full_query) From ddd6407955544fd003b62cc2c34c05e5191d6fa0 Mon Sep 17 00:00:00 2001 From: DudeNr33 <3929834+DudeNr33@users.noreply.github.com> Date: Mon, 6 Jun 2022 21:27:21 +0200 Subject: [PATCH 03/10] Switch to actively maintained GitHub API library (github3.py); extract changelog entry to display from issue body in markdown format. --- .github/PULL_REQUEST_TEMPLATE.md | 11 +++++++++ .pre-commit-config.yaml | 2 +- doc/exts/pylint_changelog.py | 42 ++++++++++++++++++++------------ doc/requirements.txt | 2 +- 4 files changed, 40 insertions(+), 17 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 90a6b12c3a..1d6bd06a68 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -23,6 +23,17 @@ To ease the process of reviewing your PR, do make sure to complete the following | ✓ | :hammer: Refactoring | | ✓ | :scroll: Docs | +## Changelog + + + + + + ## Description diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6a715d5a03..267c6e99cd 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -102,7 +102,7 @@ repos: "platformdirs==2.2.0", "types-pkg_resources==0.1.3", "types-docutils==0.18.3", - "PyGithub==1.55", + "github3.py~=3.2", ] exclude: tests(/\w*)*/functional/|tests/input|tests(/.*)+/conftest.py|doc/data/messages|tests(/\w*)*data/ - repo: https://github.com/pre-commit/mirrors-prettier diff --git a/doc/exts/pylint_changelog.py b/doc/exts/pylint_changelog.py index d47ad92a0b..8af155c74c 100644 --- a/doc/exts/pylint_changelog.py +++ b/doc/exts/pylint_changelog.py @@ -9,15 +9,16 @@ """ from __future__ import annotations +import re from collections.abc import Iterable from docutils import frontend, nodes -from docutils.parsers.rst import Parser, directives +from docutils.parsers.rst import directives from docutils.utils import new_document -from github import Github -from github.Issue import Issue +from github3 import login # type: ignore[import] +from github3.search.issue import IssueSearchResult # type: ignore[import] +from myst_parser.docutils_ import Parser # type: ignore[import] from sphinx.application import Sphinx -from sphinx.parsers import RSTParser from sphinx.util import logging from sphinx.util.docutils import SphinxDirective @@ -31,7 +32,11 @@ class ChangelogDirective(SphinxDirective): "hide_if_empty": directives.flag, } has_content = True - parser = RSTParser() + parser = Parser() + changelog_pattern = re.compile( + r"\n(?P.*)\n", + flags=re.MULTILINE, + ) def run(self): if not self.config.pylint_changelog_token: @@ -42,10 +47,11 @@ def run(self): if caption: result.append(nodes.title(text=caption)) list_node = nodes.bullet_list( + "", *( self._build_changelog_entry(issue) for issue in self._get_relevant_issues() - ) + ), ) result.append(list_node) logger.info("Found %d issues for this query.", len(list_node)) @@ -54,30 +60,36 @@ def run(self): return [] return result - def _get_relevant_issues(self) -> Iterable[Issue]: + def _get_relevant_issues(self) -> Iterable[IssueSearchResult]: full_query = self._build_query() - gh = Github(login_or_token=self.config.pylint_changelog_token) - logger.info("Searching for pull requests matching query %s", full_query) + gh = login(token=self.config.pylint_changelog_token) + logger.info("Searching for issues/pull requests matching query %s", full_query) return gh.search_issues(query=full_query) def _build_query(self) -> str: user = self.config.pylint_changelog_user project = self.config.pylint_changelog_project query = self.options.get("query") - full_query = f"is:pr is:closed repo:{user}/{project} {query}" + full_query = f"repo:{user}/{project} {query}" for excluded_label in self.config.pylint_changelog_exclude_labels: full_query += f' -label:"{excluded_label}"' return full_query - def _build_changelog_entry(self, issue: Issue) -> nodes.list_item: - text = f"{issue.title}\n\nPR: `#{issue.number} `_" - return nodes.list_item("", *self._parse_as_rst(text).children) + def _build_changelog_entry(self, issue: IssueSearchResult) -> nodes.list_item: + match = self.changelog_pattern.search(issue.body) + if match: + text = match.group("entry").strip() + else: + logger.info("PR #%d is missing the changelog section.", issue.number) + text = issue.title + text += f"\n\nPR: [#{issue.number}](https://github.com/PyCQA/pylint/pull/{issue.number})" + return nodes.list_item("", *self._parse_markdown(text).children) - def _parse_as_rst(self, text: str) -> nodes.document: + def _parse_markdown(self, text: str) -> nodes.document: parser = Parser() components = (Parser,) settings = frontend.OptionParser(components=components).get_default_values() - document = new_document("", settings=settings) + document = new_document("", settings=settings) parser.parse(text, document) return document diff --git a/doc/requirements.txt b/doc/requirements.txt index 7d162fca48..d479b5328b 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -2,5 +2,5 @@ Sphinx==4.5.0 sphinx-reredirects<1 myst-parser~=0.17 furo==2022.4.7 -PyGithub==1.55 +github3.py~=3.2 -e . From 2d1803d6c912dda0c457c1c9c05f98f180d53a43 Mon Sep 17 00:00:00 2001 From: DudeNr33 <3929834+DudeNr33@users.noreply.github.com> Date: Sat, 11 Jun 2022 20:11:37 +0200 Subject: [PATCH 04/10] Allow multiline changelog entries and merge Pierre's CI check to make sure the PR body contains a changelog entry. --- .github/PULL_REQUEST_TEMPLATE.md | 5 ++++- .github/workflows/changelog.yml | 24 ++++++++++++++++++++++++ doc/exts/pylint_changelog.py | 12 +++++++++--- 3 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/changelog.yml diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 1d6bd06a68..a6147613c0 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -28,7 +28,10 @@ To ease the process of reviewing your PR, do make sure to complete the following diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml new file mode 100644 index 0000000000..e97497695d --- /dev/null +++ b/.github/workflows/changelog.yml @@ -0,0 +1,24 @@ +name: changelog + +on: + pull_request: + types: [opened, synchronize, labeled, unlabeled, reopened] + +permissions: + contents: read + +jobs: + build: + name: Changelog Entry Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Grep PR description for changelog content + if: + contains(github.event.pull_request.labels.*.name, 'skip news :mute:') != true + run: | + [[ github.event.pull_request.body =~ \n(.*\n)* ]] || \ + echo "Please add '\nYOUR CHANGELOG ENTRY\n' to the description of the PR \ + (or if appropriate, ask a maintainer to add the 'skip news' label)" && \ + exit 1) diff --git a/doc/exts/pylint_changelog.py b/doc/exts/pylint_changelog.py index 8af155c74c..e2d1bba495 100644 --- a/doc/exts/pylint_changelog.py +++ b/doc/exts/pylint_changelog.py @@ -34,13 +34,15 @@ class ChangelogDirective(SphinxDirective): has_content = True parser = Parser() changelog_pattern = re.compile( - r"\n(?P.*)\n", + r"\n(?P(.*\n)*)", flags=re.MULTILINE, ) def run(self): if not self.config.pylint_changelog_token: - logger.warning("A GitHub token is required to generate the changelog.") + logger.info( + "No Github token provided. Changelog generation will be skipped." + ) return [] result = [] caption = self.options.get("caption") @@ -80,7 +82,11 @@ def _build_changelog_entry(self, issue: IssueSearchResult) -> nodes.list_item: if match: text = match.group("entry").strip() else: - logger.info("PR #%d is missing the changelog section.", issue.number) + logger.warning( + "PR #%d is missing the changelog section. " + "Using the PR title as substitute.", + issue.number, + ) text = issue.title text += f"\n\nPR: [#{issue.number}](https://github.com/PyCQA/pylint/pull/{issue.number})" return nodes.list_item("", *self._parse_markdown(text).children) From dd6a33f1a23e46349afefc25c6134226528a615d Mon Sep 17 00:00:00 2001 From: DudeNr33 <3929834+DudeNr33@users.noreply.github.com> Date: Sat, 11 Jun 2022 20:28:24 +0200 Subject: [PATCH 05/10] Remove checkout from action and use `action-regex-match` instead --- .github/workflows/changelog.yml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index e97497695d..0f0a8823ed 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -12,13 +12,11 @@ jobs: name: Changelog Entry Check runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - - name: Grep PR description for changelog content + - uses: actions-ecosystem/action-regex-match@v2 + name: Check PR description for changelog content if: contains(github.event.pull_request.labels.*.name, 'skip news :mute:') != true - run: | - [[ github.event.pull_request.body =~ \n(.*\n)* ]] || \ - echo "Please add '\nYOUR CHANGELOG ENTRY\n' to the description of the PR \ - (or if appropriate, ask a maintainer to add the 'skip news' label)" && \ - exit 1) + with: + text: ${{ github.event.pull_request.body }} + regex: '\n(.*\n)*' + flags: gm From 269ff42f16c79a84ea586144edc68315a40db811 Mon Sep 17 00:00:00 2001 From: DudeNr33 <3929834+DudeNr33@users.noreply.github.com> Date: Sat, 11 Jun 2022 20:41:11 +0200 Subject: [PATCH 06/10] Also emit error message if no match is found --- .github/workflows/changelog.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index 0f0a8823ed..6640815cdd 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -13,6 +13,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions-ecosystem/action-regex-match@v2 + id: regex-match name: Check PR description for changelog content if: contains(github.event.pull_request.labels.*.name, 'skip news :mute:') != true @@ -20,3 +21,12 @@ jobs: text: ${{ github.event.pull_request.body }} regex: '\n(.*\n)*' flags: gm + + - name: Emit warning if changelog is missing + if: + contains(github.event.pull_request.labels.*.name, 'skip news :mute:') != true + && ${{ steps.regex-match.outputs.match == '' }} + run: | + "Please add '\nYOUR CHANGELOG ENTRY\n' to the description of the PR \ + (or if appropriate, ask a maintainer to add the 'skip news' label)" && \ + exit 1) From 8749f70e235d84ff85d976c2013d72b4d6cbbdbf Mon Sep 17 00:00:00 2001 From: DudeNr33 <3929834+DudeNr33@users.noreply.github.com> Date: Sat, 11 Jun 2022 20:44:20 +0200 Subject: [PATCH 07/10] Remove unexpecte `)` --- .github/workflows/changelog.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index 6640815cdd..111dba7581 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -29,4 +29,4 @@ jobs: run: | "Please add '\nYOUR CHANGELOG ENTRY\n' to the description of the PR \ (or if appropriate, ask a maintainer to add the 'skip news' label)" && \ - exit 1) + exit 1 From 9465cfdad839a8203ad32ba0c5e6cd5c597ff28a Mon Sep 17 00:00:00 2001 From: DudeNr33 <3929834+DudeNr33@users.noreply.github.com> Date: Sat, 11 Jun 2022 20:46:54 +0200 Subject: [PATCH 08/10] Too stupid for shell scripting --- .github/workflows/changelog.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index 111dba7581..be4bd7d62c 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -27,6 +27,6 @@ jobs: contains(github.event.pull_request.labels.*.name, 'skip news :mute:') != true && ${{ steps.regex-match.outputs.match == '' }} run: | - "Please add '\nYOUR CHANGELOG ENTRY\n' to the description of the PR \ + echo "Please add \n\n\nYOUR CHANGELOG ENTRY\n\n\n to the description of the PR \ (or if appropriate, ask a maintainer to add the 'skip news' label)" && \ exit 1 From a03d032a2dff2810a1ab381ad35f7924c3bf4820 Mon Sep 17 00:00:00 2001 From: DudeNr33 <3929834+DudeNr33@users.noreply.github.com> Date: Sun, 12 Jun 2022 10:50:49 +0200 Subject: [PATCH 09/10] Run changelog CI also if PR body is edited --- .github/workflows/changelog.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index be4bd7d62c..e3bfd048de 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -2,7 +2,7 @@ name: changelog on: pull_request: - types: [opened, synchronize, labeled, unlabeled, reopened] + types: [opened, synchronize, labeled, unlabeled, reopened, edited] permissions: contents: read From 3e6de080dd4c041c75317434749ff8afab39f012 Mon Sep 17 00:00:00 2001 From: DudeNr33 <3929834+DudeNr33@users.noreply.github.com> Date: Mon, 13 Jun 2022 19:55:52 +0200 Subject: [PATCH 10/10] Use `contains` instead of regex --- .github/workflows/changelog.yml | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index e3bfd048de..48f7e4375b 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -12,20 +12,12 @@ jobs: name: Changelog Entry Check runs-on: ubuntu-latest steps: - - uses: actions-ecosystem/action-regex-match@v2 - id: regex-match - name: Check PR description for changelog content - if: - contains(github.event.pull_request.labels.*.name, 'skip news :mute:') != true - with: - text: ${{ github.event.pull_request.body }} - regex: '\n(.*\n)*' - flags: gm - - name: Emit warning if changelog is missing if: contains(github.event.pull_request.labels.*.name, 'skip news :mute:') != true - && ${{ steps.regex-match.outputs.match == '' }} + && (contains(github.event.pull_request.body, '') != + true || contains(github.event.pull_request.body, '') != + true) run: | echo "Please add \n\n\nYOUR CHANGELOG ENTRY\n\n\n to the description of the PR \ (or if appropriate, ask a maintainer to add the 'skip news' label)" && \