tools: do not swallow error in lint-nix workflow#62292
Open
aduh95 wants to merge 3 commits intonodejs:mainfrom
Open
tools: do not swallow error in lint-nix workflow#62292aduh95 wants to merge 3 commits intonodejs:mainfrom
lint-nix workflow#62292aduh95 wants to merge 3 commits intonodejs:mainfrom
Conversation
Collaborator
|
Review requested:
|
Renegade334
reviewed
Mar 17, 2026
.github/workflows/linters.yml
Outdated
Comment on lines
+159
to
+160
| - run: git --no-pager diff | ||
| if: ${{ failure() && steps.lint-step.conclusion == 'failure' }} |
Member
There was a problem hiding this comment.
If we go with this approach, then for human readability, it might be helpful if this step had a name.
Renegade334
approved these changes
Mar 17, 2026
Comment on lines
155
to
+157
| nix-shell -I nixpkgs=./tools/nix/pkgs.nix -p 'nixfmt-tree' --run ' | ||
| treefmt --quiet --ci | ||
| ' || git --no-pager diff --exit-code | ||
| ' && EXIT_CODE="$?" || EXIT_CODE="$?" |
Member
There was a problem hiding this comment.
Nit:
Suggested change
| nix-shell -I nixpkgs=./tools/nix/pkgs.nix -p 'nixfmt-tree' --run ' | |
| treefmt --quiet --ci | |
| ' || git --no-pager diff --exit-code | |
| ' && EXIT_CODE="$?" || EXIT_CODE="$?" | |
| nix-shell -I nixpkgs=./tools/nix/pkgs.nix -p 'nixfmt-tree' --run 'treefmt --quiet --ci' | |
| EXIT_CODE="$?" |
Contributor
Author
There was a problem hiding this comment.
That wouldn't work AFAICT, GitHub adds -e by default, see https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#defaultsrunshell
We need the ||, or an explicit set +e
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The workflow is written in a way that if
nix-shellfails without changing any local file, the error is swallowed. E.g. in https://github.com/nodejs/node/actions/runs/23114271551/job/67137410705, the linter fails witherror: Build failed due to failed dependencybut the workflow exits as green.