diff --git a/.github/workflows/check-links.yml b/.github/workflows/check-links.yml new file mode 100644 index 000000000000..d2d9d1dd32eb --- /dev/null +++ b/.github/workflows/check-links.yml @@ -0,0 +1,18 @@ +name: Check links and refcache # cSpell:ignore refcache + +on: + pull_request: + +jobs: + check-formatting: + name: Check links and refcache + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - run: npm install + - run: npm run build + - run: npm run _check:links + + - name: Fail on uncommitted refcache changes + run: npm run diff:fail diff --git a/netlify.toml b/netlify.toml index 9a59a2d7e2a6..4faece341421 100644 --- a/netlify.toml +++ b/netlify.toml @@ -1,9 +1,9 @@ [build] publish = "public" -command = "npm run s build:preview diff:fail" +command = "npm run s build:preview diff:check" [context.production] -command = "npm run s build:production diff:fail" +command = "npm run s build:production diff:check" [[redirects]] from = "https://docs.opentelemetry.io/*" diff --git a/package.json b/package.json index a10ec94bcab1..e10a0edbfb7b 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "_check:formatting": "npx prettier --check .", "_check:links": "HTMLTEST_ARGS='--log-level 1' npm run __check:links", "_check:links:internal": "npm run __check:links", + "_check:links--warn": "npm run _check:links || (echo; echo 'WARNING: see link-checker output for issues.'; echo)", "_get:no": "echo SKIPPING get operation", "_get:submodule:non-lang": "npm run _get:submodule -- content-modules/opentelemetry-specification themes/docsy", "_get:submodule": "set -x && git submodule update --init ${DEPTH:- --depth 1}", @@ -33,8 +34,8 @@ "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; git diff | head -100; exit 1)", "get:submodule": "npm run _get:${GET:-submodule}", "make:public": "make public ls-public", - "postbuild:preview": "npm run _check:links", - "postbuild:production": "npm run _check:links", + "postbuild:preview": "npm run _check:links--warn", + "postbuild:production": "npm run _check:links--warn", "prebuild:preview": "run-s _prebuild", "prebuild:production": "run-s _prebuild check:formatting", "prebuild": "npm run _prebuild",