mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
62 lines
1.9 KiB
YAML
62 lines
1.9 KiB
YAML
name: PR Checks
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
changed-files:
|
|
required: true
|
|
type: string
|
|
description: JSON string containing information about changed files
|
|
secrets:
|
|
github-token:
|
|
description: The GitHub token to use to comment on PRs
|
|
required: true
|
|
|
|
permissions:
|
|
contents: read
|
|
pull-requests: write
|
|
|
|
jobs:
|
|
|
|
Check-Changed-Files-Docstrings:
|
|
name: Check Docstrings For Changed Files On PR
|
|
runs-on: ubuntu-latest
|
|
if: ${{ github.event_name == 'pull_request' && fromJSON(inputs.changed-files)['salt'] }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-python@v4
|
|
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
|
|
|
|
- name: Check Docstrings
|
|
id: check-known-missing-docstrings
|
|
continue-on-error: true
|
|
shell: bash
|
|
run: |
|
|
set -o pipefail
|
|
pre-commit run --hook-stage manual check-known-missing-docstrings \
|
|
--show-diff-on-failure --color=never \
|
|
--files ${{ join(fromJSON(inputs.changed-files)['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
|