Add GitHub Actions CI (build + format check on PRs) - #2
Merged
Conversation
Runs dotnet build and dotnet format whitespace --verify-no-changes on every PR targeting main, per the recommendation in HANDOFF.md. Also normalizes checkout line endings to CRLF (git config --global core.autocrlf true) so the format check sees the same line endings on the windows-latest runner as a local Windows dev machine, since .cs files are committed as LF with no .gitattributes to normalize them. Lightly updates CONTRIBUTING.md's pre-PR verification note to mention this now also runs automatically in CI. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GXAuGMLB44T5Zv5o5ZzKah
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
.github/workflows/build.yml: a GitHub Actions workflow that, on every pull request targetingmain, on awindows-latestrunner (required forUseWindowsForms=true):dotnet-version: '10.0.x'), matching the project'snet10.0-windows7.0TFM.dotnet restore+dotnet build WitcherScriptMerger.sln --configuration Release.dotnet format whitespace WitcherScriptMerger.sln --verify-no-changes.Also lightly updates
CONTRIBUTING.md's pre-PR verification bullet to mention this now runs automatically in CI (still tells contributors to run it locally first, since CI failing shouldn't be the first time you find out).Why
HANDOFF.md(gitignored, local project-history notes — not part of this diff) explicitly calls out that this repo has no CI at all and recommends exactly this workflow as a prerequisite before adding it as a required status check onmain's branch protection. Today,dotnet buildanddotnet format whitespace --verify-no-changesare manual, undocumented-until-a-human-remembers steps; this makes them automatic on every PR.I did not touch branch protection / required status checks — that's a GitHub repo-settings change outside code and outside a contributor's permissions. Once this workflow has merged and run successfully at least once, the repo owner should consider adding "Build & format check" as a required status check on
main(currentlyrequired_status_checks: null).A note on line endings
This repo commits
.csfiles as LF (no.gitattributes) but.editorconfigmandatesend_of_line = crlf, and locally that's reconciled bycore.autocrlf=trueconverting LF→CRLF on checkout.dotnet format whitespaceenforces the CRLF rule. Since a CI runner's git config is not guaranteed to default toautocrlf=true, the workflow explicitly setsgit config --global core.autocrlf truebeforeactions/checkout@v4so the format check sees the same line endings CI would see on a normal Windows dev box. I verified the failure mode this guards against by temporarily converting a tracked.csfile to LF-only in a working copy and re-running the format command — it fails hard with anENDOFLINEdiagnostic on every line of that file, confirming this isn't a false safety net.How I verified it
actionlint(v1.7.7) and ran it against the workflow — zero findings.dotnet build WitcherScriptMerger.sln --configuration Releasetwice — once under the SDK already selected on this machine (an unrelated 11.0 preview picked up in the absence of aglobal.json), and again with a throwaway (never committed)global.jsonpinning10.0.204, to match what CI'ssetup-dotnet@v4step will actually install. Both succeeded with the same 7 pre-existing warnings (CA1823/NU1510) already onmain— no new warnings introduced by this change.dotnet format whitespace WitcherScriptMerger.sln --verify-no-changesunder the pinned 10.0.204 SDK — passes clean (0 changes needed), confirming the CI step will pass againstmain's current state.code-reviewskill: ran it against the diff; addressed its two actionable findings (CONTRIBUTING.md's local verification command now matches CI's--configuration Releaseexactly; addedsetup-dotnet's NuGet cache, keyed off the.csprojsince there's nopackages.lock.json). Its third finding (the new YAML file itself is LF, seemingly against.editorconfig) turned out to be a false positive — checkedgit cat-file -p HEAD:.editorconfigand confirmed the repo's own.editorconfigis also committed as LF; non-.csfiles are apparently committed LF in this repo already (autocrlf handles the working-tree presentation), so the new workflow file matches existing convention, not violates it.gh api repos/TheValiantOne/WitcherScriptMerger/actions/permissions→enabled: true) before pushing, then pushed the branch and opened this PR to let the workflow run for real against a live PR — see the Checks tab on this PR for the actual outcome (reporting it in my agent summary regardless of pass/fail, per the verification bar this repo holds AI-assisted changes to).AI assistance disclosure
This PR (workflow YAML, the
CONTRIBUTING.mdedit, and all verification steps above) was produced by a Claude Code agent perCONTRIBUTING.md's AI-assisted-development section. Commits carry the standardCo-Authored-Bytrailer.