-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #70 from gabemontero/rel-note-linter
add release note linter
- Loading branch information
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
--- | ||
name: Release Note Linter | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
verify: | ||
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}" | ||
echo "First making sure you have not left the PR template as is" | ||
# Describe any user facing changes here, or delete this block. | ||
TEMPLATE_LEFT_AS_IS=$(wget -q -O- https://api.github.com/repos/shipwright-io/cli/pulls/${PR_NUMBER} | jq '.body | match("(Describe any user facing changes here, or delete this block)")') | ||
if [ -z "${TEMPLATE_LEFT_AS_IS}" ]; then | ||
echo "You appear to have attempted to update the PR template to define a release note." | ||
else | ||
echo "You have not made any changes for release notes in your PR description. Edit your PR description per the instructions at https://raw.githubusercontent.com/shipwright-io/cli/main/.github/pull_request_template.md" | ||
exit 1 | ||
fi | ||
echo "Now checking against valid structure for release notes" | ||
MATCHES=$(wget -q -O- https://api.github.com/repos/shipwright-io/cli/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/cli/main/.github/pull_request_template.md" | ||
exit 1 | ||
else | ||
echo "Your Release Notes are properly in place!" | ||
fi |