Skip to content

Commit

Permalink
ci: add empty test-plan check
Browse files Browse the repository at this point in the history
  • Loading branch information
dannysauer committed Aug 17, 2023
1 parent dc006b1 commit 684f921
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/pr-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
name: "PR Validation"

on: # yamllint disable-line rule:truthy
#pull_request_target:
pull_request:
types:
- opened
- edited
# - synchronize

jobs:
validate-test-plan:
runs-on: ubuntu-latest
env:
# both used by create-file-action
FILE_NAME: ./pr_body
FILE_DATA: ${{ github.event.pull_request.body }}
steps:
- name: get body into file
uses: finnp/create-file-action@2.0.0
- name: extract test plan
uses: sean0x42/markdown-extract@v2
id: testplan-with-comment
with:
file: ${{ env.FILE_NAME }}
pattern: "Test Plan"
no-print-matched-heading: true
- name: validate test plan
id: validate
shell: python
env:
DATA: ${{ steps.testplan-with-comment.outputs.markdown }}
run: |
import re
from os import environ
comment = re.compile(r"<!---.*?-->", flags=re.DOTALL)
body = comment.sub("", environ["DATA"]).strip()
print(f"plan='{body}'")
if not body:
raise SystemExit("Empty test plan")
# continue-on-error: true
# - name: comment on failure
# if: steps.validate.outcome != 'success'

0 comments on commit 684f921

Please sign in to comment.