Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: CI

on:
push:
branches: [ main, development ]
pull_request:
branches: [ main, development ]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.13'
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install dependencies
run: |
poetry config virtualenvs.create false
poetry install --with dev
- name: Install pytest
run: poetry add --group dev pytest
- name: Run tests
run: poetry run pytest
- name: Run linting
run: |
poetry run black --check .
poetry run isort --check-only .
poetry run detect-secrets scan
Comment on lines +11 to +34

Check warning

Code 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 Autofix

AI 6 months ago

The best way to fix the problem is to explicitly set a least-privilege permissions block at the root level of the workflow file (.github/workflows/ci.yml). Since the job shown only reads repository contents (for checkout and installing dependencies), and does not push code, publish releases, or interact with pull requests/issues, it only requires read access to the contents. Thus, add the following at the top (under the name: line, before on:):

permissions:
  contents: read

No other changes, imports, or methods are needed for this fix.


Suggested changeset 1
.github/workflows/ci.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1,4 +1,6 @@
 name: CI
+permissions:
+  contents: read
 
 on:
   push:
EOF
@@ -1,4 +1,6 @@
name: CI
permissions:
contents: read

on:
push:
Copilot is powered by AI and may make mistakes. Always verify output.
19 changes: 19 additions & 0 deletions .github/workflows/delete-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Delete merged branch

on:
pull_request:
types: [closed]

permissions:
contents: write

jobs:
delete-branch:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Delete merged branch
run: gh branch delete ${{ github.head_ref }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Loading