-
Notifications
You must be signed in to change notification settings - Fork 234
Add pre-commit hook for Zizmor #3861
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
Conversation
A static analysis tool for GitHub Actions. Docs at https://woodruffw.github.io/zizmor/usage/#use-with-pre-commit
0862101 to
cd2fcd6
Compare
Different environment variable syntax for Powershell
.github/workflows/ci_tests_dev.yaml
Outdated
| call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" | ||
| cmake -G Ninja .. ^ | ||
| -DCMAKE_INSTALL_PREFIX=${{ env.GMT_INSTALL_DIR }} ^ | ||
| -DCMAKE_INSTALL_PREFIX=${env:GMT_INSTALL_DIR} ^ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Windows CI is failing, maybe try the one below (xref: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables#using-the-env-context-to-access-environment-variable-values):
| -DCMAKE_INSTALL_PREFIX=${env:GMT_INSTALL_DIR} ^ | |
| -DCMAKE_INSTALL_PREFIX=$env:GMT_INSTALL_DIR ^ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't think it's because of the path? It looks set to GMT_INSTALL_DIR: D:\a\_temp/gmt-install-dir with or without the curly braces, same as at https://github.com/GenericMappingTools/pygmt/actions/runs/13889360104/job/38858639159#step:8:21
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Owh, looks like the Cmake build on Windows didn't complete - https://github.com/GenericMappingTools/pygmt/actions/runs/13934908307/job/39000590987#step:8:669
[0/1] Install the project...
CMake Warning (dev) at cmake_install.cmake:5 (set):
Syntax error in cmake code at
D:/a/pygmt/pygmt/gmt/build/cmake_install.cmake:5
when parsing string
D:/a/pygmt/pygmt/gmt/build/${env:GMT_INSTALL_DIR}
syntax error, unexpected cal_SYMBOL, expecting } (30)
Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.
-- Install configuration: "Release"
CMake Error at src/cmake_install.cmake:36 (file):
file cannot create directory:
D:/a/pygmt/pygmt/gmt/build/${env:GMT_INSTALL_DIR}/lib. Maybe need
administrative privileges.
Call Stack (most recent call first):
cmake_install.cmake:37 (include)
FAILED: CMakeFiles/install.util
C:\Windows\system32\cmd.exe /C "cd /D D:\a\pygmt\pygmt\gmt\build && "C:\Program Files\CMake\bin\cmake.exe" -P cmake_install.cmake"
ninja: build stopped: subcommand failed.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, looking at https://github.com/GenericMappingTools/pygmt/actions/runs/13934908307/job/39000590987#step:8:435, there are these lines:
* Locations:
* Installing GMT in : D:/a/pygmt/pygmt/gmt/build/${env:GMT_INSTALL_DIR}
* GMT_DATADIR : D:/a/pygmt/pygmt/gmt/build/${env:GMT_INSTALL_DIR}/share
* GMT_DOCDIR : D:/a/pygmt/pygmt/gmt/build/${env:GMT_INSTALL_DIR}/share/doc
* GMT_MANDIR : D:/a/pygmt/pygmt/gmt/build/${env:GMT_INSTALL_DIR}/share/man
So the environment variable replacement isn't working on powershell Edit: wait, we're not using powershell, it seems to be just regular Windows cmd.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, syntax should be %GMT_INSTALL_DIR% according to https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#example-running-a-command-using-windows-cmd 🤞
Co-authored-by: Dongdong Tian <[email protected]>
This reverts commit ee4f75e.
Description of proposed changes
Zizmor is a static analysis tool for GitHub Actions, designed to help identify security issues.
Output from initial run at https://github.com/GenericMappingTools/pygmt/actions/runs/13934163536/job/38998263248?pr=3861#step:5:59:
Details
References:
Fixes #
Preview:
Reminders
make formatandmake checkto make sure the code follows the style guide.doc/api/index.rst.Slash Commands
You can write slash commands (
/command) in the first line of a comment to performspecific operations. Supported slash command is:
/format: automatically format and lint the code