@@ -114,19 +114,25 @@ jobs:
114114 for file in $(cat changed_sol.txt); do
115115 # Walk up to find package.json
116116 dir="$file"
117+ found=false
117118 while [ "$dir" != "." ]; do
118119 dir=$(dirname "$dir")
119120 if [ -f "$dir/package.json" ]; then
120121 relative_file="${file#$dir/}"
121122 echo " Checking $file"
122123 (cd "$dir" && npx solhint --max-warnings=0 --noPrompt --noPoster "$relative_file")
124+ found=true
123125 break
124126 fi
125127 done
128+ if [ "$found" = false ]; then
129+ echo "::error::No package.json found for $file - workflow needs fixing"
130+ exit 1
131+ fi
126132 done
127133
128134 # Check formatting with prettier
129- cat changed_sol.txt | xargs npx prettier --check --cache --log-level warn
135+ cat changed_sol.txt | xargs -r npx prettier --check --cache --log-level warn
130136 fi
131137
132138 - name : Lint TypeScript/JavaScript files
@@ -139,8 +145,8 @@ jobs:
139145 git ls-files '*.js' '*.ts' '*.cjs' '*.mjs' '*.jsx' '*.tsx' | xargs -r npx prettier --check --cache --log-level warn --no-error-on-unmatched-pattern
140146 elif [ "${{ steps.changed_files.outputs.ts_js_count }}" -gt "0" ]; then
141147 echo "Linting changed TypeScript/JavaScript files..."
142- cat changed_ts_js.txt | xargs npx eslint --max-warnings=0 --no-warn-ignored
143- cat changed_ts_js.txt | xargs npx prettier --check --cache --log-level warn --no-error-on-unmatched-pattern
148+ cat changed_ts_js.txt | xargs -r npx eslint --max-warnings=0 --no-warn-ignored
149+ cat changed_ts_js.txt | xargs -r npx prettier --check --cache --log-level warn --no-error-on-unmatched-pattern
144150 fi
145151
146152 - name : Lint Markdown files
@@ -153,8 +159,8 @@ jobs:
153159 git ls-files '*.md' | xargs -r npx prettier --check --cache --log-level warn --no-error-on-unmatched-pattern
154160 elif [ "${{ steps.changed_files.outputs.md_count }}" -gt "0" ]; then
155161 echo "Linting changed Markdown files..."
156- cat changed_md.txt | xargs npx markdownlint --ignore-path .gitignore --ignore-path .markdownlintignore
157- cat changed_md.txt | xargs npx prettier --check --cache --log-level warn --no-error-on-unmatched-pattern
162+ cat changed_md.txt | xargs -r npx markdownlint --ignore-path .gitignore --ignore-path .markdownlintignore
163+ cat changed_md.txt | xargs -r npx prettier --check --cache --log-level warn --no-error-on-unmatched-pattern
158164 fi
159165
160166 - name : Lint JSON files
@@ -164,10 +170,10 @@ jobs:
164170 if [ "${{ steps.lint_mode.outputs.mode }}" = "all" ]; then
165171 echo "Linting all JSON files..."
166172 # Exclude Ignition deployment artifacts and other build artifacts
167- git ls-files '*.json' | grep -v -E '(ignition/deployments/.*/artifacts/|ignition/deployments/.*/build-info/|/\.openzeppelin/|deployments/.*/solcInputs/)' | xargs -r npx prettier --check --cache --log-level warn --no-error-on-unmatched-pattern
173+ git ls-files '*.json' | { grep -v -E '(ignition/deployments/.*/artifacts/|ignition/deployments/.*/build-info/|/\.openzeppelin/|deployments/.*/solcInputs/)' || true; } | xargs -r npx prettier --check --cache --log-level warn --no-error-on-unmatched-pattern
168174 elif [ "${{ steps.changed_files.outputs.json_count }}" -gt "0" ]; then
169175 echo "Linting changed JSON files..."
170- cat changed_json.txt | grep -v -E '(ignition/deployments/.*/artifacts/|ignition/deployments/.*/build-info/|/\.openzeppelin/|deployments/.*/solcInputs/)' | xargs -r npx prettier --check --cache --log-level warn --no-error-on-unmatched-pattern
176+ cat changed_json.txt | { grep -v -E '(ignition/deployments/.*/artifacts/|ignition/deployments/.*/build-info/|/\.openzeppelin/|deployments/.*/solcInputs/)' || true; } | xargs -r npx prettier --check --cache --log-level warn --no-error-on-unmatched-pattern
171177 fi
172178
173179 - name : Lint YAML files
@@ -180,8 +186,8 @@ jobs:
180186 git ls-files '*.yml' '*.yaml' | xargs -r npx prettier --check --cache --log-level warn --no-error-on-unmatched-pattern
181187 elif [ "${{ steps.changed_files.outputs.yaml_count }}" -gt "0" ]; then
182188 echo "Linting changed YAML files..."
183- cat changed_yaml.txt | xargs npx yaml-lint
184- cat changed_yaml.txt | xargs npx prettier --check --cache --log-level warn --no-error-on-unmatched-pattern
189+ cat changed_yaml.txt | xargs -r npx yaml-lint
190+ cat changed_yaml.txt | xargs -r npx prettier --check --cache --log-level warn --no-error-on-unmatched-pattern
185191 fi
186192
187193 - name : Check lint results
0 commit comments