-
Notifications
You must be signed in to change notification settings - Fork 235
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
Merged
Merged
Changes from 5 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
fcff56e
Add pre-commit hook for Zizmor
weiji14 15b1a93
Set persist-credentials: false with actions/checkout
weiji14 cd2fcd6
Set permissions: {} for GitHub Actions workflows
weiji14 6e57354
Fix potential sources of code injection via template expansion
weiji14 53a31a6
Use ${env:GMT_INSTALL_DIR} on Windows
weiji14 ee4f75e
Set $env:GMT_INSTALL_DIR without braces
weiji14 cdae545
Revert "Set $env:GMT_INSTALL_DIR without braces"
weiji14 4cafdeb
Try running GMT build on Windows Powershell core
weiji14 3b2b21f
Back to using Windows cmd, use %GMT_INSTALL_DIR%
weiji14 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,8 @@ on: | |
| schedule: | ||
| - cron: '0 12 * * 0' | ||
|
|
||
| permissions: {} | ||
|
|
||
| jobs: | ||
| check_links: | ||
| name: Check Links | ||
|
|
@@ -26,12 +28,14 @@ jobs: | |
| uses: actions/[email protected] | ||
| with: | ||
| path: repository | ||
| persist-credentials: false | ||
|
|
||
| - name: Checkout the documentation | ||
| uses: actions/[email protected] | ||
| with: | ||
| ref: gh-pages | ||
| path: documentation | ||
| persist-credentials: false | ||
|
|
||
| - name: Link Checker | ||
| id: lychee | ||
|
|
@@ -72,7 +76,8 @@ jobs: | |
| if: env.lychee_exit_code != 0 | ||
| run: | | ||
| cd repository/ | ||
| title="Link Checker Report on ${{ steps.date.outputs.date }}" | ||
| title="Link Checker Report on ${CURRENT_DATE}" | ||
| gh issue create --title "$title" --body-file /tmp/lychee-out.md | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| CURRENT_DATE: ${{ steps.date.outputs.date }} | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,6 +43,8 @@ concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | ||
|
|
||
| permissions: {} | ||
|
|
||
| jobs: | ||
| docs: | ||
| name: ${{ matrix.os }} | ||
|
|
@@ -73,6 +75,7 @@ jobs: | |
| with: | ||
| # fetch all history so that setuptools-scm works | ||
| fetch-depth: 0 | ||
| persist-credentials: false | ||
|
|
||
| - name: Get current week number of year | ||
| id: date | ||
|
|
@@ -159,10 +162,11 @@ jobs: | |
| if: github.event_name == 'push' && matrix.os == 'ubuntu-latest' | ||
|
|
||
| - name: Upload the HTML ZIP archive and PDF as release assets | ||
| run: gh release upload ${{ github.ref_name }} doc/_build/pygmt-docs.zip doc/_build/pygmt-docs.pdf | ||
| run: gh release upload ${REF_NAME} doc/_build/pygmt-docs.zip doc/_build/pygmt-docs.pdf | ||
| if: github.event_name == 'release' && matrix.os == 'ubuntu-latest' | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| REF_NAME: ${{ github.ref_name }} | ||
|
|
||
| - name: Checkout the gh-pages branch | ||
| uses: actions/[email protected] | ||
|
|
@@ -172,6 +176,7 @@ jobs: | |
| path: deploy | ||
| # Download the entire history | ||
| fetch-depth: 0 | ||
| persist-credentials: false | ||
| if: (github.event_name == 'release' || github.event_name == 'push') && (matrix.os == 'ubuntu-latest') | ||
|
|
||
| - name: Push the built HTML to gh-pages | ||
|
|
||
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,6 +14,8 @@ on: | |
| paths: | ||
| - 'pygmt/tests/baseline/*.png.dvc' | ||
|
|
||
| permissions: {} | ||
|
|
||
| jobs: | ||
| dvc-diff: | ||
| name: DVC image diff | ||
|
|
@@ -25,6 +27,7 @@ jobs: | |
| with: | ||
| # fetch all history so that dvc diff works | ||
| fetch-depth: 0 | ||
| persist-credentials: false | ||
|
|
||
| - name: Setup data version control (DVC) | ||
| uses: iterative/[email protected] | ||
|
|
@@ -53,6 +56,7 @@ jobs: | |
| - name: Generate the image diff report | ||
| env: | ||
| repo_token: ${{ github.token }} | ||
| PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }} | ||
| run: | | ||
| echo -e "## Summary of changed images\n" > report.md | ||
| echo -e "This is an auto-generated report of images that have changed on the DVC remote\n" >> report.md | ||
|
|
@@ -94,7 +98,7 @@ jobs: | |
| echo -e "</details>\n" >> report.md | ||
|
|
||
| # Mention git commit SHA in the report | ||
| echo -e "Report last updated at commit ${{ github.event.pull_request.head.sha }}" >> report.md | ||
| echo -e "Report last updated at commit ${PR_HEAD_SHA}" >> report.md | ||
|
|
||
| # create/update PR comment | ||
| cml comment update report.md | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,9 +3,13 @@ | |
| # This workflow is triggered in a PR if the slash command `/format` is used. | ||
| # | ||
| name: format-command | ||
|
|
||
| on: | ||
| repository_dispatch: | ||
| types: [format-command] | ||
|
|
||
| permissions: {} | ||
|
|
||
| jobs: | ||
| format: | ||
| runs-on: ubuntu-latest | ||
|
|
@@ -23,6 +27,7 @@ jobs: | |
| token: ${{ steps.generate-token.outputs.token }} | ||
| repository: ${{ github.event.client_payload.pull_request.head.repo.full_name }} | ||
| ref: ${{ github.event.client_payload.pull_request.head.ref }} | ||
| persist-credentials: false | ||
|
|
||
| # Setup Python environment | ||
| - uses: actions/[email protected] | ||
|
|
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,6 +34,8 @@ on: | |
| # branches: | ||
| # - main | ||
|
|
||
| permissions: {} | ||
|
|
||
| jobs: | ||
| build: | ||
| name: Build distribution 📦 | ||
|
|
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,6 +24,8 @@ jobs: | |
| steps: | ||
| - name: Checkout | ||
| uses: actions/[email protected] | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Setup data version control (DVC) | ||
| uses: iterative/[email protected] | ||
|
|
@@ -39,6 +41,7 @@ jobs: | |
| shasum -a 256 baseline-images.zip | ||
|
|
||
| - name: Upload baseline image as a release asset | ||
| run: gh release upload ${{ github.ref_name }} baseline-images.zip | ||
| run: gh release upload ${REF_NAME} baseline-images.zip | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| REF_NAME: ${{ github.ref_name }} | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,8 @@ on: | |
| branches: | ||
| - main | ||
|
|
||
| permissions: {} | ||
|
|
||
| jobs: | ||
| update_release_draft: | ||
| runs-on: ubuntu-latest | ||
|
|
||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,8 @@ on: | |
| schedule: | ||
| - cron: '0 0 * * *' | ||
|
|
||
| permissions: {} | ||
|
|
||
| jobs: | ||
| style_check: | ||
| name: Style Checks | ||
|
|
@@ -25,6 +27,8 @@ jobs: | |
| # Checkout current git repository | ||
| - name: Checkout | ||
| uses: actions/[email protected] | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| # Setup Python | ||
| - name: Set up Python | ||
|
|
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,6 +25,8 @@ concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | ||
|
|
||
| permissions: {} | ||
|
|
||
| jobs: | ||
| static_check: | ||
| name: Static Type Check | ||
|
|
@@ -34,6 +36,8 @@ jobs: | |
| # Checkout current git repository | ||
| - name: Checkout | ||
| uses: actions/[email protected] | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| # Setup Python | ||
| - name: Set up Python | ||
|
|
||
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
Oops, something went wrong.
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.
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):
Uh oh!
There was an error while loading. Please reload this page.
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-dirwith or without the curly braces, same as at https://github.com/GenericMappingTools/pygmt/actions/runs/13889360104/job/38858639159#step:8:21There 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
Uh oh!
There was an error while loading. Please reload this page.
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:
So the environment variable replacement isn't working on
powershellEdit: wait, we're not usingpowershell, it seems to be just regular Windowscmd.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 🤞