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