Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid printing an error message when upload-sarif location is not a git directory #1162

Closed
crenshaw-dev opened this issue Aug 2, 2022 · 4 comments · Fixed by #1860
Closed
Assignees
Labels
bug Something isn't working CodeQL Action This repo! Helps for internal planning

Comments

@crenshaw-dev
Copy link

I have a workflow which has to check out the repo to a specific (non-default) directory.

The upload-sarif action produces this error:

fatal: not a git repository (or any of the parent directories): .git
Failed to call git to get current commit. Continuing with data from environment or input: Error: The process '/usr/bin/git' failed with exit code 128
Error: The process '/usr/bin/git' failed with exit code 128
    at ExecState._setResult (/home/runner/work/_actions/github/codeql-action/v2/node_modules/@actions/exec/lib/toolrunner.js:592:25)
    at ExecState.CheckComplete (/home/runner/work/_actions/github/codeql-action/v2/node_modules/@actions/exec/lib/toolrunner.js:575:18)
    at ChildProcess.<anonymous> (/home/runner/work/_actions/github/codeql-action/v2/node_modules/@actions/exec/lib/toolrunner.js:469:27)
    at ChildProcess.emit (node:events:390:28)
    at maybeClose (node:internal/child_process:1064:16)
    at Socket.<anonymous> (node:internal/child_process:450:11)
    at Socket.emit (node:events:390:[28](https://github.com/argoproj/argo-cd/runs/7634411066?check_suite_focus=true#step:5:29))
    at Pipe.<anonymous> (node:net:687:12)

I believe the action expects the working directory to be a git repo.

@aibaars
Copy link
Collaborator

aibaars commented Aug 2, 2022

Did the upload action actually fail? The phrase Continuing with data from environment or input: suggests that is should carry on regardless.

@crenshaw-dev
Copy link
Author

It did not fail. Maybe the appropriate fix is to change the error message? It's really unclear based on the current message whether I should be concerned, i.e. why it would want to be run in a git repo.

@hmakholm
Copy link
Contributor

hmakholm commented Aug 2, 2022

Since there's a fallback with a fairly good chance of working (namely falling back to the environment variable set by the Actions runner), the message arguably at least shouldn't be presented with a stack trace -- that makes it look more alarming than it ought to.

@aeisenberg aeisenberg added the bug Something isn't working label Aug 10, 2022
@aeisenberg aeisenberg changed the title Add a working-directory option to the upload-sarif action Avoid printing an error message when upload-sarif location is not a git directory Jul 31, 2023
@aeisenberg aeisenberg added the CodeQL Action This repo! Helps for internal planning label Jul 31, 2023
@aeisenberg
Copy link
Contributor

I changed the issue title to better reflect the actual problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working CodeQL Action This repo! Helps for internal planning
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants