initial commit #1
Workflow file for this run
This file contains hidden or 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
| name: Pull Request Checks | |
| on: | |
| pull_request: | |
| types: [opened, edited, synchronize] | |
| jobs: | |
| pr_checks: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Setup Python 3.10 | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.10" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install ansible-lint pytest pytest-cov black | |
| - name: Run Ansible Lint on playbooks, tasks, and roles | |
| run: ansible-lint . | |
| - name: Run Pytest with Coverage Check | |
| run: | | |
| pytest --cov=. --cov-fail-under=85 | |
| - name: Check Code Formatting with Black | |
| run: black --check . | |
| - name: Validate PR Description | |
| uses: actions/github-script@v6 | |
| with: | |
| script: | | |
| const core = require('@actions/core'); | |
| const pr = await github.rest.pulls.get({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| pull_number: context.payload.pull_request.number, | |
| }); | |
| const body = pr.data.body || ""; | |
| const requiredSections = [ | |
| "Description", | |
| "Test Cases", | |
| "Checklist", | |
| ]; | |
| const missingSections = requiredSections.filter(section => !body.includes(section)); | |
| if(missingSections.length > 0) { | |
| core.setFailed(`PR Description is missing the following sections: ${missingSections.join(", ")}`); | |
| } |