microsoft/typespec
Publicmirrored from https://github.com/microsoft/typespecAvailable
eng/scripts/check-for-changed-files.js
31lines · modecode
| 1 | // @ts-check |
| 2 | import { run } from "./legacy-helpers.js"; |
| 3 | |
| 4 | const proc = run("git", ["status", "--porcelain"], { |
| 5 | encoding: "utf-8", |
| 6 | stdio: [null, "pipe", "pipe"], |
| 7 | }); |
| 8 | |
| 9 | if (proc.stdout) { |
| 10 | console.log(proc.stdout); |
| 11 | } |
| 12 | |
| 13 | if (proc.stderr) { |
| 14 | console.error(proc.stderr); |
| 15 | } |
| 16 | |
| 17 | if (proc.stdout || proc.stderr) { |
| 18 | if (process.argv[2] !== "publish") { |
| 19 | console.error( |
| 20 | `ERROR: Files above were changed during PR validation, but not included in the PR. |
| 21 | Include any automated changes such as sample output, spec.html, and ThirdPartyNotices.txt in your PR.` |
| 22 | ); |
| 23 | } else { |
| 24 | console.error( |
| 25 | `ERROR: Changes have been made since this publish PR was prepared. |
| 26 | In the future, remember to alert coworkers to avoid merging additional changes while publish PRs are in progress. |
| 27 | Close this PR, run prepare-publish again.` |
| 28 | ); |
| 29 | } |
| 30 | process.exit(1); |
| 31 | } |
| 32 | |