-
Notifications
You must be signed in to change notification settings - Fork 5
Chore/ci #124
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
Chore/ci #124
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| name: CI | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| paths-ignore: | ||
| - pyproject.toml | ||
| pull_request: | ||
| branches: | ||
| - main | ||
|
|
||
| jobs: | ||
| commit-lint: | ||
| if: ${{ github.event_name == 'pull_request' }} | ||
| uses: ./.github/workflows/commitlint.yml | ||
|
|
||
| lint: | ||
| uses: ./.github/workflows/lint.yml |
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 |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| name: Commit Lint | ||
|
|
||
| on: | ||
| workflow_call | ||
|
|
||
| jobs: | ||
| commitlint: | ||
| name: Commit Lint | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Setup Node | ||
| uses: actions/setup-node@v3 | ||
| with: | ||
| node-version: 22 | ||
|
|
||
| - name: Install Git | ||
| run: | | ||
| if ! command -v git &> /dev/null; then | ||
| echo "Git is not installed. Installing..." | ||
| sudo apt-get update | ||
| sudo apt-get install -y git | ||
| else | ||
| echo "Git is already installed." | ||
| fi | ||
|
|
||
| - name: Install commitlint | ||
| run: | | ||
| npm install conventional-changelog-conventionalcommits | ||
| npm install commitlint@latest | ||
| npm install @commitlint/config-conventional | ||
|
|
||
| - name: Configure | ||
| run: | | ||
| echo "export default { extends: ['@commitlint/config-conventional'] };" > commitlint.config.js | ||
|
|
||
| - name: Validate PR commits with commitlint | ||
| run: | | ||
| git fetch origin pull/${{ github.event.pull_request.number }}/head:pr_branch | ||
| npx commitlint --from ${{ github.event.pull_request.base.sha }} --to pr_branch --verbose | ||
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 |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| name: Lint | ||
|
|
||
| on: | ||
| workflow_call | ||
|
|
||
| jobs: | ||
| # Job that runs when custom version testing is enabled - just completes successfully | ||
| skip-lint: | ||
| name: Skip Lint (Custom Version Testing) | ||
| runs-on: ubuntu-latest | ||
| if: contains(github.event.pull_request.labels.*.name, 'test-core-dev-version') | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - name: Skip lint for custom version testing | ||
| run: | | ||
| echo "Custom version testing enabled - skipping normal lint process" | ||
| echo "This job completes successfully to allow PR merging" | ||
|
|
||
| # Job that runs normal lint process when custom version testing is NOT enabled | ||
| lint: | ||
| name: Lint | ||
| runs-on: ubuntu-latest | ||
| if: "!contains(github.event.pull_request.labels.*.name, 'test-core-dev-version')" | ||
| permissions: | ||
| contents: read | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup uv | ||
| uses: astral-sh/setup-uv@v5 | ||
Check warningCode scanning / CodeQL Unpinned tag for a non-immutable Action in workflow Medium
Unpinned 3rd party Action 'Lint' step
Uses Step Error loading related location Loading |
||
| with: | ||
| enable-cache: true | ||
|
|
||
| - name: Setup Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version-file: ".python-version" | ||
|
|
||
| - name: Install dependencies | ||
| run: uv sync --all-extras | ||
|
|
||
| - name: Check static types | ||
| run: uv run mypy --config-file pyproject.toml . | ||
|
|
||
| - name: Check linting | ||
| run: uv run ruff check . | ||
|
|
||
| - name: Check formatting | ||
| run: uv run ruff format --check . | ||
|
|
||
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
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.
Check warning
Code scanning / CodeQL
Checkout of untrusted code in trusted context Medium
Copilot Autofix
AI 4 months ago
To fix the problem, you should prevent the checkout and execution of untrusted PR code in a privileged context. The best practice is to separate the untrusted PR handling from privileged workflows. Specifically:
pull_request(unprivileged) rather than viaworkflow_callorpull_request_target.workflow_runpattern as described in the background.Specifically, in
.github/workflows/commitlint.yml, you should remove or adjust the step:and not run
commitlinton untrusted PR code when triggered from a privileged context.