Develop #19
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 Validation | |
| on: | |
| pull_request: | |
| branches: | |
| - 'main' | |
| types: [opened, synchronize, reopened] | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| actions: write | |
| jobs: | |
| validate: | |
| name: Build & Test PR | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| global-json-file: global.json | |
| - name: Restore .NET tools | |
| run: dotnet tool restore | |
| - name: Run Tests | |
| run: dotnet run .build/targets.cs test | |
| - name: ReportGenerator | |
| uses: danielpalme/[email protected] | |
| with: | |
| reports: TestResults/coverage.xml | |
| targetdir: coveragereport | |
| reporttypes: 'Html;MarkdownSummaryGithub;Badges' | |
| - name: Upload full coverage report artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-report | |
| path: coveragereport/ | |
| - name: Add coverage summary to pull request | |
| # This step only runs for pull requests | |
| if: github.event_name == 'pull_request' | |
| run: | | |
| # Use the official GitHub CLI to post a comment | |
| # It will find and update its own previous comment, or create a new one | |
| gh pr comment ${{ github.event.number }} --body-file coveragereport/SummaryGithub.md | |
| env: | |
| # The GITHUB_TOKEN is automatically provided by GitHub Actions | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Add coverage summary to job summary | |
| # This adds the same markdown report to the GitHub Actions summary page | |
| run: cat coveragereport/SummaryGithub.md >> $GITHUB_STEP_SUMMARY | |
| shell: bash |