-
Notifications
You must be signed in to change notification settings - Fork 0
ci: update workflow #7
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| version: 2 | ||
| updates: | ||
| - package-ecosystem: "pip" | ||
| directory: "/" | ||
| schedule: | ||
| interval: "daily" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| fail-on-severity: 'low' | ||
| allow-licenses: | ||
| - 'BSD-2-Clause' | ||
| - 'BSD-3-Clause' | ||
| - 'BSD-3-Clause-Clear' | ||
| - 'BSD-2-Clause-Views' | ||
| - 'MIT' | ||
| - 'Apache-2.0' | ||
| - 'ISC' | ||
| - 'BlueOak-1.0.0' | ||
| - '0BSD' | ||
| - 'Python-2.0' | ||
| - 'LGPL-3.0' | ||
| - 'MPL-2.0' | ||
| fail-on-scopes: | ||
| - 'runtime' | ||
| - 'development' | ||
| - 'unknown' | ||
| license-check: true | ||
| vulnerability-check: true | ||
| allow-dependencies-licenses: | ||
| - 'pkg:pypi/PyGithub@2.2.0' | ||
| - 'pkg:pypi/psycopg2-binary' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| name: 'Prepare test environment' | ||
| inputs: | ||
| PYTHON_VERSION: | ||
| description: 'Python version to use' | ||
| required: true | ||
| SOURCE_PATH: | ||
| description: 'Path to the source code directory' | ||
| required: false | ||
| default: 'src' | ||
| type: string | ||
| VIRTUALENV_PATH: | ||
| description: 'Virtualenv path' | ||
| required: false | ||
| default: 'virtualenv' | ||
| type: string | ||
|
|
||
| runs: | ||
| using: "composite" | ||
| steps: | ||
| - name: Checkout main repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| path: ${{ inputs.SOURCE_PATH }} | ||
| fetch-depth: 0 | ||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: ${{ inputs.PYTHON_VERSION }} | ||
| cache: 'pip' | ||
|
|
||
| - name: Install dependencies | ||
| shell: bash | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| python -m venv ${{ inputs.VIRTUALENV_PATH }} | ||
| source ${{ inputs.VIRTUALENV_PATH }}/*/activate | ||
| python --version | ||
| pip install ./${{ inputs.SOURCE_PATH }} | ||
| pip install -r ${{ inputs.SOURCE_PATH }}/requirements-test.txt | ||
| pip install -r ${{ inputs.SOURCE_PATH }}/requirements-dev.txt | ||
| pip install -r ${{ inputs.SOURCE_PATH }}/requirements.txt |
| Original file line number | Diff line number | Diff line change | |||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,30 @@ | |||||||||||||||||||||||
| name: Check Code Standard | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| on: | |||||||||||||||||||||||
| pull_request: | |||||||||||||||||||||||
| types: [opened, synchronize] | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| env: | |||||||||||||||||||||||
| SOURCE_PATH: 'src' | |||||||||||||||||||||||
| VIRTUALENV_PATH: 'virtualenv' | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| jobs: | |||||||||||||||||||||||
| run_check_standard: | |||||||||||||||||||||||
| strategy: | |||||||||||||||||||||||
| fail-fast: false | |||||||||||||||||||||||
| matrix: | |||||||||||||||||||||||
| python_version: ['3.10', '3.13'] | |||||||||||||||||||||||
| runs-on: ubuntu-latest | |||||||||||||||||||||||
| steps: | |||||||||||||||||||||||
| - name: Checkout this repository | |||||||||||||||||||||||
| uses: actions/checkout@v4 | |||||||||||||||||||||||
| with: | |||||||||||||||||||||||
| path: current_repo | |||||||||||||||||||||||
| - uses: ./current_repo/.github/prepare_test_env | |||||||||||||||||||||||
| with: | |||||||||||||||||||||||
| PYTHON_VERSION: ${{ matrix.python_version }} | |||||||||||||||||||||||
| - name: Run mfd-code-standard | |||||||||||||||||||||||
| shell: bash | |||||||||||||||||||||||
| run: | | |||||||||||||||||||||||
| source ${{ github.workspace }}/${{ env.VIRTUALENV_PATH }}/*/activate | |||||||||||||||||||||||
| mfd-code-standard --project-dir ${{ github.workspace }}/${{ env.SOURCE_PATH }} | |||||||||||||||||||||||
|
Comment on lines
+13
to
+30
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
Copilot AutofixAI 6 months ago To fix this problem, explicitly add a
Suggested changeset
1
.github/workflows/check_code_standard.yml
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
|||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | |||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,12 @@ | |||||||||||||||||||||||
| name: Title + Commit Validation | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| on: | |||||||||||||||||||||||
| pull_request: | |||||||||||||||||||||||
| types: [opened, synchronize] | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| jobs: | |||||||||||||||||||||||
| validate_pr_format: | |||||||||||||||||||||||
| uses: intel/mfd/.github/workflows/check_pr_format.yml@main | |||||||||||||||||||||||
| with: | |||||||||||||||||||||||
| REPOSITORY_NAME: ${{ github.event.pull_request.head.repo.full_name }} | |||||||||||||||||||||||
| BRANCH_NAME: ${{ github.head_ref }} | |||||||||||||||||||||||
|
Comment on lines
+9
to
+12
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}
Copilot AutofixAI 7 months ago To fix the problem, you should explicitly specify the minimal permissions required at either the workflow or job level. Since the workflow permissions:
contents: readIf needed, you can adjust the permissions later based on actual requirements of the workflow.
Suggested changeset
1
.github/workflows/check_pr_format.yml
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
|||||||||||||||||||||||
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Copilot Autofix
AI 6 months ago
The best way to fix this problem is to add an explicit
permissionsblock to the workflow. For a reusable workflow like this, placing it at the workflow root (just after theon:block and before jobs) ensures all jobs inherit these default least-privilege permissions unless overridden.The workflow steps do not need repository write access, but they do interact with pull requests (commenting), which requires
pull-requests: write. Most other steps (checkout, reading code, uploading to PyPI) only requirecontents: read.Implementation:
Edit
.github/workflows/build_upload_whl.ymland, after thenameandon:sections (e.g., right beforejobs:at line 49), add:This reduces GitHub token permissions to the minimum needed for the workflow: read access to repository contents and write access to pull request comments.