Skip to content

Commit

Permalink
ci: prevent to add items without docs
Browse files Browse the repository at this point in the history
  • Loading branch information
moreal committed Nov 12, 2024
1 parent 8bcf1e7 commit a550baf
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,45 @@ jobs:
if [ "$count" -gt 0 ]; then
exit 1
fi
count-no-docs-on-baseref:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' }}
outputs:
count: ${{ steps.count-no-docs.outputs.count }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.base_ref }}
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- id: count-no-docs
run: |
set -ev
count=$(dotnet build -p GenerateDocumentationFile=true -p 'DocumentationFile=docs.xml' -consoleloggerparameters:WarningsOnly | grep -c -E "CS(1573|1591)")
echo "count=$count" >> "$GITHUB_OUTPUT"
count-no-docs-on-headref:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' }}
outputs:
count: ${{ steps.count-no-docs.outputs.count }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- id: count-no-docs
run: |
set -ev
count=$(dotnet build -p GenerateDocumentationFile=true -p 'DocumentationFile=docs.xml' -consoleloggerparameters:WarningsOnly | grep -c -E "CS(1573|1591)")
echo "count=$count" >> "$GITHUB_OUTPUT"
check-items-without-docs-increased:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' }}
needs: [count-no-docs-on-headref, count-no-docs-on-baseref]
steps:
- run: '[ "$BASE_COUNT" -ge "$HEAD_COUNT" ]'
env:
BASE_COUNT: ${{ needs.count-no-docs-on-baseref.outputs.count }}
HEAD_COUNT: ${{ needs.count-no-docs-on-headref.outputs.count }}

0 comments on commit a550baf

Please sign in to comment.