mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Move the PR checks workflow to the main CI workflow
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
parent
49ec43d0be
commit
a1f8fe74f1
2 changed files with 29 additions and 21 deletions
15
.github/workflows/ci.yml
vendored
15
.github/workflows/ci.yml
vendored
|
@ -200,7 +200,19 @@ jobs:
|
|||
with:
|
||||
changed-files: ${{ needs.prepare-ci.outputs.changed-files }}
|
||||
|
||||
|
||||
pr-checks:
|
||||
name: PR Checks
|
||||
if: ${{ fromJSON(needs.prepare-ci.outputs.jobs)['github-hosted-runners'] && github.event_name == 'pull_request' }}
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
uses: ./.github/workflows/pr-checks-action.yml
|
||||
needs:
|
||||
- prepare-ci
|
||||
with:
|
||||
changed-files: ${{ needs.prepare-ci.outputs.changed-files }}
|
||||
secrets:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
windows-2016:
|
||||
name: Windows 2016
|
||||
|
@ -467,6 +479,7 @@ jobs:
|
|||
- docs
|
||||
- lint
|
||||
- twine-check
|
||||
- pr-checks
|
||||
- almalinux-8
|
||||
- almalinux-9
|
||||
- amazonlinux-2
|
||||
|
|
|
@ -1,20 +1,27 @@
|
|||
name: PR Checks
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize]
|
||||
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:
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
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
|
||||
|
@ -33,33 +40,21 @@ jobs:
|
|||
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
|
||||
- name: Check Docstrings
|
||||
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 --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
|
||||
--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 }}
|
||||
GITHUB_TOKEN: ${{ secrets.github-token }}
|
||||
run: |
|
||||
python .github/workflows/scripts/pr-docstring-comments.py \
|
||||
--org ${{ github.repository_owner }} \
|
Loading…
Add table
Reference in a new issue