Files
PX4-Autopilot/.github/workflows/python_checks.yml
T
Julian Oes ddc63c57e8 ci(workflows): set token permissions on every workflow (#29489)
Eleven workflows had no top-level permissions block, so any job without
its own ran with the repository's default token permissions. Set the
least each one needs: read-only contents for the build, test and
Crowdin upload workflows, which only check out code and use their own
tokens for anything else; issues, pull requests and the Actions cache
for the stale bot. Workflows whose jobs already set permissions get a
read-only default for any job added later.

This clears the actions/missing-workflow-permissions code scanning
alerts.

Assisted-by: Claude:claude-opus-5-5

Signed-off-by: Julian Oes <julian@oes.ch>
2026-10-30 04:47:05 +13:00

64 lines
1.8 KiB
YAML

name: Python CI Checks
on:
push:
branches:
- 'main'
paths-ignore:
- 'docs/**'
pull_request:
branches:
- '**'
paths-ignore:
- 'docs/**'
permissions:
contents: read
jobs:
build:
runs-on: [runs-on,runner=1cpu-linux-x64,image=ubuntu24-full-x64,"run-id=${{ github.run_id }}"]
steps:
- uses: runs-on/action@v2
- uses: actions/checkout@v6
with:
fetch-depth: 1
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: "3.10"
- name: Install tools
run: |
pip install mypy types-requests types-PyYAML flake8 pyyaml
pip install -r Tools/setup/test-requirements.txt
- name: Check MAVSDK test scripts with mypy
run: mypy --strict test/mavsdk_tests/*.py
- name: Check MAVSDK test scripts with flake8
run: flake8 --config test/mavsdk_tests/.flake8 test/mavsdk_tests/*.py
- name: Check USB ID tooling with mypy and flake8
working-directory: Tools/ci
run: |
mypy --strict check_usb_ids.py usb_ids_runner.py test_check_usb_ids.py test_usb_ids_runner.py
flake8 check_usb_ids.py usb_ids_runner.py test_check_usb_ids.py test_usb_ids_runner.py
- name: Check AI review tooling and the PR review poster
working-directory: Tools/ci
run: |
mypy --strict -p ai_review
flake8 ai_review test_pr_review_poster.py
python3 -m unittest discover -s ai_review -t . -v
python3 -m unittest -v test_pr_review_poster
- name: Check ROS workspace tooling
run: |
flake8 Tools/ros2/*.py
python3 -m unittest discover -s Tools/ros2 -p 'test_*.py'
- name: Test submodule check
run: python3 -m unittest discover -s Tools -p 'test_check_submodules.py' -v