Skip to content

Commit f69219f

Browse files
authored
CI script changes to fail on diff (open-telemetry#2364)
1 parent c9f3f76 commit f69219f

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ All matched files use Prettier code style!
126126
To _fix_ formatting run:
127127

128128
```console
129-
$ npm run check:formatting -- --write
129+
$ npm run prettier:write
130130
```
131131

132132
### Submodule changes

netlify.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[build]
22
publish = "public"
3-
command = "npm run build:preview"
3+
command = "npm run s build:preview diff:fail"
44

55
[context.production]
6-
command = "npm run build:production"
6+
command = "npm run s build:production diff:fail"
77

88
[[redirects]]
99
from = "https://docs.opentelemetry.io/*"

package.json

+6-2
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,29 @@
88
"scripts": {
99
"__check:links": "make --keep-going check-links",
1010
"_build": "hugo --cleanDestinationDir -e dev -DFE",
11+
"_check:formatting": "npx prettier --check .",
1112
"_check:links": "HTMLTEST_ARGS='--log-level 1' npm run __check:links",
1213
"_check:links:internal": "npm run __check:links",
1314
"_get:no": "echo SKIPPING get operation",
1415
"_get:submodule:non-lang": "npm run _get:submodule -- content-modules/opentelemetry-specification themes/docsy",
1516
"_get:submodule": "set -x && git submodule update --init ${DEPTH:- --depth 1}",
1617
"_prebuild": "run-s get:submodule cp:spec",
1718
"_prepare:docsy": "cd themes/docsy && npm install",
18-
"_serve:hugo": "hugo serve --disableFastRender -DFE --minify",
19+
"_serve:hugo": "hugo serve -DFE --minify",
1920
"_serve": "netlify dev -c \"npm run _serve:hugo\"",
2021
"all": "npm-run-all",
2122
"build:preview": "set -x && npm run _build -- --minify --baseURL \"${DEPLOY_PRIME_URL:-/}\"",
2223
"build:production": "hugo --cleanDestinationDir --minify",
2324
"build": "npm run _build",
2425
"cd:public": "cd public &&",
2526
"check": "npm run all -- check:*",
26-
"check:formatting": "npx prettier --check .",
27+
"check:formatting": "npm run _check:formatting || (echo '[help] Run: npm run prettier:write'; exit 1)",
2728
"check:links": "npm run _check:links",
2829
"check:links:internal": "npm run _check:links:internal",
2930
"clean": "make clean",
3031
"cp:spec": "./scripts/content-modules/cp-pages.sh",
32+
"diff:check": "git diff --name-only --exit-code || (echo; echo 'WARNING: the files above have not been committed'; echo)",
33+
"diff:fail": "git diff --name-only --exit-code || (echo; echo 'ERROR: the files above have changed. Locally rerun `npm run test` and commit changes'; echo; exit 1)",
3134
"get:submodule": "npm run _get:${GET:-submodule}",
3235
"make:public": "make public ls-public",
3336
"postbuild:preview": "npm run _check:links",
@@ -40,6 +43,7 @@
4043
"prepare": "run-s get:submodule _prepare:docsy",
4144
"preserve:hugo": "npm run _prebuild",
4245
"prettier:no-ignore": "npx prettier --ignore-path ''",
46+
"prettier:write": "npm run _check:formatting -- --write",
4347
"preserve": "npm run _prebuild",
4448
"s": "run-s",
4549
"schemas:update": "npm run update:submodule content-modules/opentelemetry-specification",

0 commit comments

Comments
 (0)