ci(deps): bump the all-actions group with 2 updates #207
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: PR Validation | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| paths-ignore: | |
| - '**.md' | |
| - 'docs/**' | |
| - '.vscode/**' | |
| - '.editorconfig' | |
| env: | |
| DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
| DOTNET_CLI_TELEMETRY_OPTOUT: true | |
| DOTNET_NOLOGO: true | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| checks: write | |
| jobs: | |
| validate-pr: | |
| name: Validate PR | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 # Full history for GitVersion | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: | | |
| 9.0.x | |
| 10.0.x | |
| cache: true | |
| cache-dependency-path: | | |
| **/packages.lock.json | |
| global.json | |
| - name: Install GitVersion | |
| uses: gittools/actions/gitversion/setup@v4 | |
| with: | |
| versionSpec: '6.x' | |
| - name: Run GitVersion | |
| id: gitversion | |
| uses: gittools/actions/gitversion/execute@v4 | |
| - name: Set version | |
| id: version | |
| run: | | |
| VERSION="${{ steps.gitversion.outputs.nuGetVersionV2 }}" | |
| echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | |
| echo "π¦ Version: $VERSION" | |
| - name: Restore dependencies | |
| run: | | |
| dotnet restore --use-lock-file | |
| dotnet tool restore | |
| - name: Build solution | |
| run: | | |
| dotnet build PatternKit.slnx \ | |
| --configuration Release \ | |
| --no-restore \ | |
| /p:ContinuousIntegrationBuild=true \ | |
| /p:Deterministic=true | |
| - name: Run tests | |
| run: | | |
| dotnet test PatternKit.slnx \ | |
| --configuration Release \ | |
| --no-build \ | |
| --verbosity normal \ | |
| --logger "trx;LogFileName=test-results.trx" \ | |
| --collect:"XPlat Code Coverage" \ | |
| --results-directory ./TestResults \ | |
| -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover | |
| - name: Publish test results | |
| uses: EnricoMi/publish-unit-test-result-action@v2 | |
| if: always() | |
| with: | |
| files: | | |
| TestResults/**/*.trx | |
| check_name: Test Results | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v6 | |
| if: always() | |
| with: | |
| files: ./TestResults/**/coverage.opencover.xml | |
| flags: unittests | |
| name: pr-${{ github.event.pull_request.number }} | |
| fail_ci_if_error: false | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| - name: Build Documentation | |
| run: | | |
| dotnet tool update -g docfx | |
| docfx metadata docs/docfx.json | |
| docfx build docs/docfx.json | |
| - name: Dry-run NuGet packaging | |
| run: | | |
| echo "π¦ Performing dry-run of NuGet packaging..." | |
| mkdir -p ./dry-run-packages | |
| # Package all library projects | |
| for project in src/PatternKit.Core \ | |
| src/PatternKit.Generators \ | |
| src/PatternKit.Generators.Abstractions; do | |
| if [ -d "$project" ]; then | |
| echo " Packing $project..." | |
| dotnet pack "$project" \ | |
| --configuration Release \ | |
| --no-build \ | |
| --output ./dry-run-packages \ | |
| /p:PackageVersion=${{ steps.version.outputs.VERSION }} \ | |
| /p:RepositoryUrl=https://github.com/JerrettDavis/PatternKit \ | |
| /p:RepositoryType=git \ | |
| /p:ContinuousIntegrationBuild=true || echo " β οΈ Failed to pack $project" | |
| fi | |
| done | |
| echo "" | |
| echo "π Dry-run packaging summary:" | |
| ls -lh ./dry-run-packages/*.nupkg 2>/dev/null || echo " No packages created" | |
| - name: Upload dry-run artifacts | |
| uses: actions/upload-artifact@v7 | |
| if: always() | |
| with: | |
| name: dry-run-artifacts-${{ github.event.pull_request.number }} | |
| path: | | |
| ./dry-run-packages/ | |
| retention-days: 7 | |
| - name: Create PR comment | |
| uses: actions/github-script@v9 | |
| if: always() | |
| with: | |
| script: | | |
| const body = `## π PR Validation Results | |
| **Version:** \`${{ steps.version.outputs.VERSION }}\` | |
| ### β Validation Steps | |
| - [x] Build solution | |
| - [x] Run tests | |
| - [x] Build documentation | |
| - [x] Dry-run NuGet packaging | |
| ### π Artifacts | |
| Dry-run artifacts have been uploaded and will be available for 7 days. | |
| --- | |
| *This comment was automatically generated by the PR validation workflow.* | |
| `; | |
| // Find existing comment | |
| const { data: comments } = await github.rest.issues.listComments({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| }); | |
| const botComment = comments.find(comment => | |
| comment.user.type === 'Bot' && | |
| comment.body.includes('PR Validation Results') | |
| ); | |
| if (botComment) { | |
| await github.rest.issues.updateComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| comment_id: botComment.id, | |
| body: body | |
| }); | |
| } else { | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body: body | |
| }); | |
| } |