From 00817dec8ce7fbf5c646ff5929d3d2e2bf666522 Mon Sep 17 00:00:00 2001 From: qu1queee Date: Tue, 4 May 2021 22:41:04 +0200 Subject: [PATCH] Adds a sanity check on release notes Validate if the PR contains a release note in the form of: - NONE - free text - action required: free text if not then fail the check. --- .github/workflows/release-notes-linter.yaml | 32 +++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/release-notes-linter.yaml diff --git a/.github/workflows/release-notes-linter.yaml b/.github/workflows/release-notes-linter.yaml new file mode 100644 index 0000000000..8eda3f6710 --- /dev/null +++ b/.github/workflows/release-notes-linter.yaml @@ -0,0 +1,32 @@ +--- +name: Release Note Linter + +on: + pull_request: + branches: + - master + +jobs: + build: + name: Release Note Linter + runs-on: ubuntu-latest + steps: + - name: Install wget + run: sudo apt-get install wget + - name: Install jq + run: sudo apt-get install jq + - name: Sanity Check Release Notes + env: + PR_NUMBER: ${{ github.event.number }} + run: | + # Validate PR release notes + echo "Going to validate PR ${PR_NUMBER}" + + MATCHES=$(wget -q -O- https://api.github.com/repos/shipwright-io/build/pulls/${PR_NUMBER} | jq '.body | match("(```release-note\r\n(.*|NONE|action required: .*)\r\n```)")') + if [ -z "${MATCHES}" ]; then + echo "Your Release Notes were not properly defined or they are not in place, please make sure you add them." + echo "See our PR template for more information: https://raw.githubusercontent.com/shipwright-io/build/master/.github/pull_request_template.md" + exit 1 + else + echo "Your Release Notes are properly in place!" + fi