forked from saltstack/salt
-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (50 loc) · 1.87 KB
/
pr-checks.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: PR Checks
on:
pull_request_target:
types: [opened, synchronize]
jobs:
Check-Changed-Files-Docstrings:
name: Check Docstrings For Changed Files On PR
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install Dependencies
env:
PIP_EXTRA_INDEX_URL: https://pypi-proxy.saltstack.net/root/local/+simple/
run: |
python -m pip install --upgrade pip
pip install pre-commit pygithub
- name: Install Pre-Commit Hooks
run: |
pre-commit install --install-hooks
- id: changed-files
name: Get Changed Files
uses: dorny/paths-filter@v2
with:
token: ${{ github.token }}
list-files: json
filters: |
salt:
- added|modified:
- 'salt/**'
- name: Check Docstrings For Changed Files On PR
id: check-known-missing-docstrings
if: github.event_name == 'pull_request_target' && steps.changed-files.outputs.salt == 'true'
continue-on-error: true
shell: bash
run: |
set -o pipefail
pre-commit run -v --hook-stage manual check-known-missing-docstrings --show-diff-on-failure --color=never --files ${{ join(fromJSON(steps.changed-files.outputs.salt_files), ' ') }} | tee output.txt
- name: Comment on PR
# Comment on PRs if pre-commit triggered a failure
if: steps.check-known-missing-docstrings.outcome == 'failure'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
python .github/workflows/scripts/pr-docstring-comments.py \
--org ${{ github.repository_owner }} \
--repo ${{ github.event.repository.name }} \
--issue ${{ github.event.number }} output.txt