Skip to content

Commit

Permalink
[CI] Fix submodule sync & pr-action adjustments (#4021)
Browse files Browse the repository at this point in the history
  • Loading branch information
chalin authored Feb 18, 2024
1 parent 19ce5c1 commit 855d651
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 22 deletions.
18 changes: 4 additions & 14 deletions .github/workflows/pr-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,11 @@ jobs:

- run: |
case $PR_ACTION in
format)
npm run format
;;
submodules)
npm run sync
;;
refcache)
npm install --omit=optional
npm run check:links
;;
all)
all|refcache)
npm install --omit=optional
npm run sync
npm run format
npm run check:links
;&
format|submodules)
npm run fix:$PR_ACTION
;;
esac
git status
Expand Down
10 changes: 5 additions & 5 deletions content/en/docs/contributing/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -380,18 +380,18 @@ GitHub also automatically assigns labels to a PR to help reviewers.

#### Fix content issues automatically

Before submitting a change to the repository, run the following command and
address any reported issues. Also commit any files changed by the `fix` script:
Before submitting a change to the repository, run the following command and (i)
address any reported issues, (ii) commit any files changed by the script:

```sh
npm run test-and-fix
```

To separately test and fix issues with your files, run:
To separately test and fix all issues with your files, run:

```sh
npm run test # checks but does not update any files
npm run fix # may update files
npm run test # Checks but does not update any files
npm run fix:all # May update files
```

To list available NPM scripts, run `npm run`.
Expand Down
11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"spelling": "cSpell:ignore docsy elemetry HTMLTEST hugo loglevel netlify prebuild precheck preinstall postbuild postget textlint -",
"spelling": "cSpell:ignore docsy elemetry HTMLTEST hugo loglevel netlify prebuild precheck preinstall postbuild postget refcache textlint -",
"Notes": [
"The 'all' runs _all_ named scripts in sequence, even if one fails; and exits with failure in that case."
],
Expand All @@ -21,14 +21,15 @@
"_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}",
"_list:check:*": "npm run --loglevel=warn | grep -Ee '^\\s*check:[^:]+$'",
"_list:fix:*": "npm run --loglevel=warn | grep -Ee '^\\s*fix:[^:]+$'",
"_list:fix:*": "npm run --loglevel=warn | grep -Ee '^\\s*fix:[^:]+$' | grep -v 'fix:all'",
"_ls-bad-filenames": "find assets content static -name '*_*' ! -name '_*'",
"_prebuild": "npm run seq -- get:submodule cp:spec",
"_prepare:docsy": "cd themes/docsy && npm install",
"_prettier:any": "npx prettier --ignore-path ''",
"_rename-to-kebab-case": "find assets content static -name '*_*' ! -name '_*' -exec sh -c 'mv \"$1\" \"${1//_/-}\"' _ {} \\;",
"_serve:hugo": "hugo server -DFE --minify",
"_serve:netlify": "netlify dev -c \"npm run _serve:hugo\"",
"_sync": "./scripts/sync-submodules.pl",
"all": "bash -c 'x=0; for c in \"$@\"; do npm run $c || x=$((x+1)); done; ((!x)) || (echo \"ERROR: some scripts failed!\" && exit 1)' -",
"build:preview": "set -x && npm run _build -- --minify",
"build:production": "hugo --cleanDestinationDir --minify",
Expand All @@ -49,11 +50,14 @@
"cp:spec": "./scripts/content-modules/cp-pages.sh",
"diff:check": "npm run _diff:check || (echo; echo 'WARNING: the files above have not been committed'; echo)",
"diff:fail": "npm run _diff:check || (echo; echo 'ERROR: the files above have changed. Locally rerun `npm run test-and-fix` and commit changes'; echo; exit 1)",
"fix:all": "npm run seq -- $(npm -s run _list:fix:*)",
"fix:dict": "find content layouts -name \"*.md\" -print0 | xargs -0 ./scripts/normalize-cspell-front-matter.pl",
"fix:filenames": "npm run _rename-to-kebab-case",
"fix:format": "npm run format",
"fix:markdown": "npm run check:markdown -- --fix",
"fix": "npm run seq -- $(npm -s run _list:fix:*)",
"fix:refcache": "npm run check:links",
"fix:submodules": "npm run _sync",
"fix": "npm run fix:all",
"format": "npm run _check:format -- --write",
"get:submodule": "npm run _get:${GET:-submodule}",
"install:netlify-cli": "npm list netlify-cli || npm install netlify-cli",
Expand All @@ -70,6 +74,7 @@
"prepare": "npm run seq -- get:submodule _prepare:docsy",
"preserve:hugo": "npm run _prebuild",
"preserve:netlify": "npm run seq -- _prebuild install:netlify-cli",
"prefix:submodules": "npm run update:submodule",
"schemas:update": "npm run update:submodule content-modules/opentelemetry-specification",
"seq": "bash -c 'for cmd in \"$@\"; do npm run $cmd || exit 1; done' - ",
"serve:hugo": "npm run _serve:hugo",
Expand Down

0 comments on commit 855d651

Please sign in to comment.