Skip to content

Commit

Permalink
Created a PR workflow. (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
pvginkel authored Nov 21, 2023
1 parent a490c3d commit d2472c6
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Update GitHub Pages

on: pull_request

jobs:
pr-build:
name: PR build
runs-on: windows-2022

steps:
- uses: actions/checkout@v4

- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1

- name: Validate prettier
run: ./runprettier.bat

- name: Check for changes by prettier
shell: pwsh
run: ./Build/Uncommitted-changes.ps1 -tool runprettier.bat

- name: Install CSharpier
run: dotnet tool restore

- name: Run CSharpier
run: dotnet csharpier .

- name: Check for changes by CSharpier
shell: pwsh
run: ./Build/Uncommitted-changes.ps1 -tool "dotnet csharpier ."

- uses: actions/cache@v3
id: cache
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-v2-${{ hashFiles('**/packages.lock.json') }}

- name: Restore Solution
run: msbuild -nodeReuse:false -maxCpuCount -target:Restore -property:Configuration="Release" Tql.sln

- name: Build Solution
run: msbuild -nodeReuse:false -maxCpuCount -target:Build -property:Configuration="Release" Tql.sln

- name: Install DocFX
run: dotnet tool update -g docfx

- name: Run DocFX
run: docfx Documentation/docfx.json
9 changes: 9 additions & 0 deletions Build/Uncommitted-Changes.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
param($tool)

$Changes = git status --porcelain

if ("$Changes".Trim() -ne "")
{
Write-Host "There are uncommitted changes. Run '$tool' and update your PR with any changes."
exit 1
}

0 comments on commit d2472c6

Please sign in to comment.